diff options
| author | Adam Soltys <[email protected]> | 2022-08-01 22:56:41 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-08-01 22:56:41 -0700 |
| commit | 63a4af3686b7a81874a87259f6ec5dd44aa97e48 (patch) | |
| tree | 78f9104ff3b97f99c3e9aaa95fbf63acc064d556 /src/routes | |
| parent | b83994d6fb38981607c2cd4d460173457377a9ba (diff) | |
| download | coinos-ui-63a4af3686b7a81874a87259f6ec5dd44aa97e48.tar.gz coinos-ui-63a4af3686b7a81874a87259f6ec5dd44aa97e48.zip | |
404 on invalid user
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/[username]/index.svelte | 1 | ||||
| -rw-r--r-- | src/routes/__error.svelte | 42 |
2 files changed, 32 insertions, 11 deletions
diff --git a/src/routes/[username]/index.svelte b/src/routes/[username]/index.svelte index 6e3978ad..6002efdc 100644 --- a/src/routes/[username]/index.svelte +++ b/src/routes/[username]/index.svelte @@ -47,7 +47,6 @@ }; </script> -<!-- need to update this IF statement to only show if the username matches a user in the DB --> {#if username} <AppHeader avatarPosition="left-[calc(15vw-48px)]" /> diff --git a/src/routes/__error.svelte b/src/routes/__error.svelte index 6cdeeac7..2d617f9d 100644 --- a/src/routes/__error.svelte +++ b/src/routes/__error.svelte @@ -1,16 +1,38 @@ +<script context="module"> + export function load({ error, status }) { + if (error.message.includes('not found')) { + error.message = 'Page not found'; + status = 404; + } + + return { + props: { + error, + status + } + }; + } +</script> + <script> - import { Icon } from '$comp'; + import { Icon, PageNotFound } from '$comp'; + export let status, error; </script> -<div class="flex justify-center items-center mt-20"> - <div class="space-y-5 text-center"> - <a href="/"> - <Icon icon="logo" /> - </a> +{#if status === 404} + <PageNotFound /> +{:else} + <div class="flex justify-center items-center mt-20"> + <div class="space-y-5 text-center"> + <a href="/"> + <Icon icon="logo" /> + </a> - <Icon icon="error" style="mx-auto w-full" /> + <Icon icon="error" style="mx-auto w-full" /> - <h1 class="font-bold text-5xl">Error</h1> - <p>Please try again or contact support.</p> + <h1 class="font-bold text-5xl">Error</h1> + <p>{error.message}</p> + <p>Please try again or contact support.</p> + </div> </div> -</div> +{/if} |
