Skip to content

Commit

Permalink
fix(layout): Use correct Next.js navigation function
Browse files Browse the repository at this point in the history
  • Loading branch information
minhnhat165 committed Jun 9, 2023
1 parent fe3668f commit 3d50292
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/(protected)/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { SidebarMenu } from '@/components/layout/sidebar-menu';
import { redirect } from 'next/navigation';
import { notFound } from 'next/navigation';
import { useUserStore } from '@/stores/user';

export interface LayoutProps {
children: React.ReactNode;
}

export default function AdminLayout({ children }: LayoutProps) {
const { role } = useUserStore((state) => state.data!);
const { role } = useUserStore.getState().data!;
if (role !== 'admin') {
redirect('/');
notFound();
}

return (
Expand Down

0 comments on commit 3d50292

Please sign in to comment.