From b71c2c210993ea886a48719326c9dca85df92bf0 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 17 Sep 2025 22:14:42 -0700 Subject: [PATCH] Add role to summons and weapons detail pages --- src/routes/database/summons/[id]/+page.server.ts | 8 ++++++-- src/routes/database/weapons/[id]/+page.server.ts | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/routes/database/summons/[id]/+page.server.ts b/src/routes/database/summons/[id]/+page.server.ts index 5442d308..de553770 100644 --- a/src/routes/database/summons/[id]/+page.server.ts +++ b/src/routes/database/summons/[id]/+page.server.ts @@ -2,8 +2,11 @@ import type { PageServerLoad } from './$types' import { get } from '$lib/api/core' import { error } from '@sveltejs/kit' -export const load: PageServerLoad = async ({ params, fetch }) => { +export const load: PageServerLoad = async ({ params, fetch, parent }) => { try { + // Get parent data to access role + const parentData = await parent() + const summon = await get(fetch, `/summons/${params.id}`) if (!summon) { @@ -11,7 +14,8 @@ export const load: PageServerLoad = async ({ params, fetch }) => { } return { - summon + summon, + role: parentData.role } } catch (err) { console.error('Failed to load summon:', err) diff --git a/src/routes/database/weapons/[id]/+page.server.ts b/src/routes/database/weapons/[id]/+page.server.ts index ccf8eac9..c780878c 100644 --- a/src/routes/database/weapons/[id]/+page.server.ts +++ b/src/routes/database/weapons/[id]/+page.server.ts @@ -2,8 +2,11 @@ import type { PageServerLoad } from './$types' import { get } from '$lib/api/core' import { error } from '@sveltejs/kit' -export const load: PageServerLoad = async ({ params, fetch }) => { +export const load: PageServerLoad = async ({ params, fetch, parent }) => { try { + // Get parent data to access role + const parentData = await parent() + const weapon = await get(fetch, `/weapons/${params.id}`) if (!weapon) { @@ -11,7 +14,8 @@ export const load: PageServerLoad = async ({ params, fetch }) => { } return { - weapon + weapon, + role: parentData.role } } catch (err) { console.error('Failed to load weapon:', err)