Skip to content

Commit

Permalink
added more errors if no org found
Browse files Browse the repository at this point in the history
 🐰
  • Loading branch information
jennifer-fintlabs committed Dec 13, 2024
1 parent 4a8808e commit d6d6423
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions app/api/MeApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ class MeApi {
});

if (apiResults.success) {
return await apiResults.data;
} else {
logger.debug(`No organisations found for user`);

throw new Response('Du er ikke tilknyttet en organisasjon', {
status: 401,
statusText: 'Du er ikke tilknyttet en organisasjon',
});
if (apiResults.data.length > 1) {
return await apiResults.data;
}
}
logger.debug(`No organisations found for user`);

throw new Response('Du er ikke tilknyttet en organisasjon', {
status: 401,
statusText: 'Du er ikke tilknyttet en organisasjon',
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
const cookieValue = await selectOrgCookie.parse(cookieHeader);

logger.debug(`Cookie value: ${cookieValue}`);
logger.debug(`Organisations from me fetch orgs: ${organisationsData}`);
logger.debug(`count Organisations from me fetch orgs: ${organisationsData.length}`);
logger.silly(`features: ${JSON.stringify(featuresResponse.data, null, 2)}`);

let selectedOrganization =
Expand Down

0 comments on commit d6d6423

Please sign in to comment.