Skip to content

Commit 568a41e

Browse files
committed
feat(unauthorized): update protected route using role-based access
1 parent 6778948 commit 568a41e

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

apps/web-app/src/app/router/ProtectedRoute.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function ProtectedRoute({
2222
allowedRoles &&
2323
!allowedRoles.some((role) => user.roles.includes(role))
2424
) {
25-
return <Navigate to="/login" replace />;
25+
return <Navigate to="/unauthorized" replace />;
2626
}
2727

2828
return children;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Link } from 'react-router-dom';
2+
3+
export default function Unauthorized() {
4+
return (
5+
<div className="flex min-h-screen flex-col items-center justify-center px-6 text-center">
6+
<h1 className="text-3xl font-bold">403 - Unauthorized</h1>
7+
8+
<p className="mt-2 text-muted-foreground">
9+
You do not have permission to access this page.
10+
</p>
11+
12+
<Link to="/" className="mt-4 text-primary underline">
13+
Go back home
14+
</Link>
15+
</div>
16+
);
17+
}
18+
19+
20+

0 commit comments

Comments
 (0)