aled
This commit is contained in:
@@ -43,9 +43,16 @@ public class ArticleController {
|
||||
//Affichage d'un article
|
||||
|
||||
@GetMapping("/show")
|
||||
public String showArticle(@RequestParam(name = "slug")int id, Model model) {
|
||||
Article article = articleService.findArticleById(id);
|
||||
return "article";
|
||||
public String showArticle(@RequestParam()int id, Model model) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (!authentication.getName().equals("anonymousUser")) {
|
||||
Article article = articleService.findArticleById(id);
|
||||
System.out.println(article);
|
||||
model.addAttribute("article", article);
|
||||
return "article";
|
||||
} else {
|
||||
return "redirect:/accueil";
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/{slug}")
|
||||
|
||||
Reference in New Issue
Block a user