mirror of
https://github.com/pheralb/svgl.git
synced 2025-02-11 09:40:31 +08:00
Merge pull request #241 from ticua07/add-error-404-handling
Handle non-existant categories and urls
This commit is contained in:
commit
72ff8b2fe4
5
src/routes/+error.svelte
Normal file
5
src/routes/+error.svelte
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { redirect } from '@sveltejs/kit';
|
||||||
|
|
||||||
|
redirect(301, '/');
|
||||||
|
</script>
|
@ -21,6 +21,11 @@ export const load = (async ({ params }) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// If SVGs array is empty, category can't exist
|
||||||
|
if (svgsByCategory.length === 0) {
|
||||||
|
return error(404, 'Not found');
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
category: slug as string,
|
category: slug as string,
|
||||||
svgs: svgsByCategory
|
svgs: svgsByCategory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user