new routes

This commit is contained in:
Alex
2025-02-20 09:06:27 +01:00
parent 54faee731d
commit ab168311a9
5 changed files with 54 additions and 58 deletions

View File

@@ -6,7 +6,6 @@ import { userDatesFromRFC3339, refreshCookie } from '$lib/utils/helpers';
export async function load({ cookies, fetch, locals }) {
const jwt = cookies.get('jwt');
try {
// Fetch user data, subscriptions, and licence categories in parallel
const response = await fetch(`${BASE_API_URI}/backend/users/all`, {
credentials: 'include',
headers: {
@@ -16,7 +15,7 @@ export async function load({ cookies, fetch, locals }) {
if (!response.ok) {
// Clear the invalid JWT cookie
cookies.delete('jwt', { path: '/' });
throw redirect(302, '/auth/login?next=/');
throw redirect(302, '/auth/login?next=admin/users/');
}
const data = await response.json();
@@ -43,6 +42,6 @@ export async function load({ cookies, fetch, locals }) {
// In case of any error, clear the JWT cookie
cookies.delete('jwt', { path: '/' });
throw redirect(302, '/auth/login?next=/');
throw redirect(302, '/auth/login?next=admin/users/');
}
}