mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: refactor the entire learnhouse project
This commit is contained in:
parent
f556e41dda
commit
4c215e91d5
247 changed files with 7716 additions and 1013 deletions
13
apps/web/services/utils/react/middlewares/views.ts
Normal file
13
apps/web/services/utils/react/middlewares/views.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import { NextRouter } from "next/router";
|
||||
|
||||
export const denyAccessToUser = (error: any, router: AppRouterInstance) => {
|
||||
if (error.status === 401) {
|
||||
router.push("/login");
|
||||
}
|
||||
|
||||
if (error.status === 403) {
|
||||
router.push("/login");
|
||||
// TODO : add a message to the user to tell him he is not allowed to access this page, route to /error
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue