mirror of
https://gitlab.com/etc404/software-engineering-project.git
synced 2026-05-10 20:52:58 +00:00
Update file SiteController.java
This commit is contained in:
@@ -27,14 +27,16 @@ public class SiteController {
|
||||
this.recipeService = recipeService;
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/")
|
||||
public String viewHomePage(Model model, Principal principal) {
|
||||
List<RecipeDto> newest = recipeService.getNewestRecipes(5);
|
||||
model.addAttribute("recipes", recipes);
|
||||
model.addAttribute("newestRecipes", newest);
|
||||
|
||||
public String viewHomePage() {
|
||||
return "redirect:/explore";
|
||||
}
|
||||
|
||||
@GetMapping("/favorites")
|
||||
public String viewFavorites(Model model, Principal principal) {
|
||||
model.addAttribute("guest", principal == null);
|
||||
model.addAttribute("newestRecipes", recipeService.getNewestRecipes(5));
|
||||
|
||||
if (principal == null) {
|
||||
model.addAttribute("recipes", List.of());
|
||||
@@ -42,7 +44,7 @@ public class SiteController {
|
||||
model.addAttribute("recipes", userService.getFavoriteRecipesByUsername(principal.getName()));
|
||||
}
|
||||
|
||||
return "redirect:/explore";
|
||||
return "home";
|
||||
}
|
||||
|
||||
@GetMapping("/login")
|
||||
|
||||
Reference in New Issue
Block a user