Dough Git

clove/pkviewer

web/src/routes/admin/credits/+page.server.ts

back to web/src/routes/admin/credits

/* web/src/routes/admin/credits/+page.server.ts */
import type { PageServerLoad } from "./$types";
import { manageApi } from "$lib/server/api.ts";
import type { AdminCredit, AdminSection } from "$lib/types.ts";

export const load: PageServerLoad = async () => {
  const result = await manageApi.get<{ sections: AdminSection[]; credits: AdminCredit[] }>(
    "/admin/credits",
  );
  return result.ok ? { loaded: true as const, ...result.value } : { loaded: false as const };
};