Auth Guard

An Auth Guard protects specific pages by ensuring only authenticated users can access them.

Auth Guard is configured at src/utils/route-guard/AuthGuard.tsx To use it, just wrap the component with AuthGuard, as shown below

src/routes/MainRoutes.tsx
element: (
    <AuthProvider>
      <AuthGuard>
        <RoleGuard>
          <AdminLayout />
        </RoleGuard>
      </AuthGuard>
    </AuthProvider>
  ),

Last updated