'How to use UUID in sveltekit route?
I have ./routes/jobs/[id].svelte
an example "id" would be: "456d7bb6-9dc5-49a3-8700-566b34c38829"
this doesn't seem to work with sveltekit.
<script>
import { onMount } from 'svelte';
import Jobs from '$api/jobs';
import User from '$api/user';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
let job = {};
onMount(async () => {
console.log('id: ', $page.params);
job = await Jobs.getById($page.params.id);
});
</script>
I get the following error instead:
404
Not found: /jobs/456d7bb6-9dc5-49a3-8700-566b34c38829
Error: Not found: /jobs/456d7bb6-9dc5-49a3-8700-566b34c38829
at resolve (file:///home/user/www/example-ui/node_modules/@sveltejs/kit/dist/ssr.js:1682:10)
at async svelteKitMiddleware (file:///home/user/www/example.com/example-ui/node_modules/@sveltejs/kit/dist/chunks/index.js:4538:22)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
