Skip to content

Commit

Permalink
added 403 for overview page (#414)
Browse files Browse the repository at this point in the history
* added 403 for overview page

* linter

* added good response.ok placement and status code for 404

* linter
  • Loading branch information
Gerwoud authored May 23, 2024
1 parent 3d4fe01 commit dd84501
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/src/loaders/submission-overview-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,20 @@ export default async function loadSubmissionOverview({
}: {
params: Params<string>;
}) {

const projectId = params.projectId;
const projectResponse = await authenticatedFetch(
`${APIURL}/projects/${projectId}`
);

if (!projectResponse.ok) {
if (projectResponse.status == 403) {
throw new Response("Not authenticated", {status: 403});
} else if (projectResponse.status == 404) {
throw new Response("Not found", {status: 404});
}
}

const projectData = (await projectResponse.json())["data"];

const overviewResponse = await authenticatedFetch(
Expand Down

0 comments on commit dd84501

Please sign in to comment.