Files
sexy/packages/frontend/src/routes/admin/users/+page.server.ts
Sebastian Krüger ebab3405b1 fix: forward session token in admin SSR load functions
Admin list queries (users, videos, articles) were using getGraphQLClient
without auth credentials, causing silent 403s on server-side loads. Now
extract session_token cookie and pass it to getAuthClient so the backend
sees the admin session on SSR requests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 12:56:47 +01:00

17 lines
558 B
TypeScript

import { adminListUsers } from "$lib/services";
export async function load({ fetch, url, cookies }) {
const token = cookies.get("session_token") || "";
const role = url.searchParams.get("role") || undefined;
const search = url.searchParams.get("search") || undefined;
const offset = parseInt(url.searchParams.get("offset") || "0", 10);
const limit = 50;
const result = await adminListUsers({ role, search, limit, offset }, fetch, token).catch(() => ({
items: [],
total: 0,
}));
return { ...result, role, search, offset, limit };
}