Skip to content

Commit

Permalink
website 404: Remove unknown organism message (#808)
Browse files Browse the repository at this point in the history
* Remove unknown organism message

* address comment from code review

* restore message

* Update website/src/routes.ts

Co-authored-by: Fabian Engelniederhammer <92720311+fengelniederhammer@users.noreply.github.com>

* Update website/src/middleware/organismValidatorMiddleware.ts

Co-authored-by: Fabian Engelniederhammer <92720311+fengelniederhammer@users.noreply.github.com>

---------

Co-authored-by: Fabian Engelniederhammer <92720311+fengelniederhammer@users.noreply.github.com>
  • Loading branch information
theosanderson and fengelniederhammer committed Jan 23, 2024
1 parent c7b4e6c commit 58aaf8a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion website/src/middleware/organismValidatorMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const organismValidatorMiddleware = defineMiddleware(async (context, next

const { organism: validatedOrganism } = cleanOrganism(organism);
if (validatedOrganism === undefined) {
return context.redirect(routes.unknownOrganismPage(organism));
return context.redirect(routes.notFoundPage());
}

return next();
Expand Down
9 changes: 1 addition & 8 deletions website/src/pages/404.astro
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
---
import BaseLayout from '../layouts/BaseLayout.astro';
const unknownOrganism = Astro.url.searchParams.get('unknownOrganism');
const errorMessage =
typeof unknownOrganism === 'string'
? `The organism "${unknownOrganism}" does not exist on this instance. `
: 'The page you are looking for does not exist. ';
---

<BaseLayout title='Not Found'>
<div class='bc'>
<h1 class='title'>Page not found</h1>
<p>
{errorMessage}
The page you are looking for does not exist.
<a href='/'>Go to start page.</a>
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion website/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const routes = {
},
userSequencesPage: (organism: string) => withOrganism(organism, `/user/seq`),
versionPage: (organism: string, accession: string) => withOrganism(organism, `/seq/${accession}/versions`),
unknownOrganismPage: (organism: string) => `/404?unknownOrganism=${organism}`,
notFoundPage: () => `/404`,
logout: () => '/logout',
};

Expand Down

0 comments on commit 58aaf8a

Please sign in to comment.