Skip to content

Commit

Permalink
Add error redirect and user persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony (Juntao) Hu committed Dec 5, 2021
1 parent f48583b commit 65652d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/src/main/java/com/amigo/control/DashboardController.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class DashboardController {
@GetMapping("/dashboard")
public ModelAndView showDashboard(@ModelAttribute User user) {
if (!user.isValid() && !presenter.hasUser()) {
return new ModelAndView("404");
return new ModelAndView("error-page");
}
if (user != null) {
if (user.isValid()) {
presenter.setUser(user);
}
ModelAndView mav = new ModelAndView("dashboard");
Expand All @@ -48,4 +48,9 @@ public ModelAndView showMatchingScreen() {
}
return mav;
}

@GetMapping("/*")
public String showError() {
return "error-page";
}
}

0 comments on commit 65652d3

Please sign in to comment.