mirror of
https://github.com/pheralb/svgl.git
synced 2024-11-10 14:46:54 +08:00
⚙ Handle non-existant categories and urls
This commit is contained in:
parent
c843669446
commit
3608829163
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…
Reference in New Issue
Block a user