Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

refactor(auth): remove isPending state from protected page middleware (#70)

Corentin THOMASSET32564fe5ee4c
diff --git a/apps/papra-client/src/modules/auth/middleware/protected-page.middleware.tsx b/apps/papra-client/src/modules/auth/middleware/protected-page.middleware.tsx
index 106b17fa..4f1ed9e8 100644
--- a/apps/papra-client/src/modules/auth/middleware/protected-page.middleware.tsx
+++ b/apps/papra-client/src/modules/auth/middleware/protected-page.middleware.tsx
@@ -8,8 +8,6 @@ export function createProtectedPage({ authType, component }: { authType: 'public
return () => {
const session = useSession();
- // const { user } = ['public', 'public-only'].includes(authType) ? {} : useCurrentUser();
-
const getIsAuthenticated = () => Boolean(session()?.data?.user);
return (
@@ -18,11 +16,9 @@ export function createProtectedPage({ authType, component }: { authType: 'public
match({
authType,
isAuthenticated: getIsAuthenticated(),
- isPending: session().isPending,
// isAdmin: user?.roles.includes('admin'),
})
- .with({ isPending: true }, () => <div>Authenticating...</div>)
.with({ authType: 'private', isAuthenticated: false }, () => <Navigate href="/login" />)
.with({ authType: 'public-only', isAuthenticated: true }, () => <Navigate href="/" />)
// .with({ authType: 'admin', isAuthenticated: false }, () => <Navigate href="/login" />)