Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
mishig25 committed Feb 23, 2024
1 parent a5593fa commit 256ee00
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/routes/settings/assistants/[assistantId]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ async function assistantOnlyIfAuthor(locals: App.Locals, assistantId?: string) {
export async function load({ parent, params, locals }) {
const data = await parent();

const assistantId = params.assistantId as string;
const assistantId = params.assistantId;

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

let isReported = false;

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

if (!assistant) {
throw redirect(302, `${base}/assistant/${params.assistantId}`);
}

return { ...data, isReported };
return { isReported };
}

export const actions: Actions = {
Expand Down

0 comments on commit 256ee00

Please sign in to comment.