refactor: remove ActionGuard and MenuProtection components, simplifying permission checks in various dashboard routes and enhancing footer with privacy policy link

This commit is contained in:
2025-12-13 10:50:57 -03:00
parent 13ec7cc8e3
commit c068715fc1
64 changed files with 504 additions and 585 deletions

View File

@@ -3,16 +3,16 @@ import { api } from '@sgse-app/backend/convex/_generated/api';
import { error, redirect } from '@sveltejs/kit';
import type { FunctionReference } from 'convex/server';
export const load = async ({ locals }) => {
export const load = async ({ locals, url }) => {
if (!locals.token) {
throw redirect(302, '/login');
throw redirect(302, '/login?redirect=' + url.pathname);
}
try {
const client = createConvexHttpClient({ token: locals.token });
const currentUser = await client.query(api.auth.getCurrentUser as FunctionReference<'query'>);
if (!currentUser) {
throw redirect(302, '/login');
throw redirect(302, '/login?redirect=' + url.pathname);
}
return { currentUser };
} catch {