mirror of
https://github.com/pheralb/svgl.git
synced 2025-12-29 08:01:36 +08:00
⚙ Handle non-existant categories and urls
This commit is contained in:
@@ -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 {
|
||||
category: slug as string,
|
||||
svgs: svgsByCategory
|
||||
|
||||
Reference in New Issue
Block a user