Skip to content

Commit 256ee00

Browse files
committed
fix typing
1 parent a5593fa commit 256ee00

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/routes/settings/assistants/[assistantId]/+page.server.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ async function assistantOnlyIfAuthor(locals: App.Locals, assistantId?: string) {
2525
export async function load({ parent, params, locals }) {
2626
const data = await parent();
2727

28-
const assistantId = params.assistantId as string;
28+
const assistantId = params.assistantId;
2929

30-
const assistant = (data.settings.assistants as string[]).find((id) => id === assistantId);
30+
const assistant = data.settings.assistants.find((id) => id === assistantId);
31+
if (!assistant) {
32+
throw redirect(302, `${base}/assistant/${params.assistantId}`);
33+
}
3134

3235
let isReported = false;
3336

@@ -40,11 +43,7 @@ export async function load({ parent, params, locals }) {
4043
isReported = !!report;
4144
}
4245

43-
if (!assistant) {
44-
throw redirect(302, `${base}/assistant/${params.assistantId}`);
45-
}
46-
47-
return { ...data, isReported };
46+
return { isReported };
4847
}
4948

5049
export const actions: Actions = {

0 commit comments

Comments
 (0)