Files
optima/src/routes/company/[id]/+page.svelte
T

26 lines
675 B
Svelte

<script>
import { onMount } from "svelte";
import { page } from "$app/stores";
import { goto } from "$app/navigation";
// client-side redirect from legacy /company/:id to /companies/:id
onMount(() => {
const unsubscribe = page.subscribe(($page) => {
const id = $page.params?.id;
if (id) {
goto(`/companies/${id}`, { replaceState: true });
} else {
goto("/companies", { replaceState: true });
}
});
unsubscribe();
});
</script>
<svelte:head>
<meta http-equiv="refresh" content="0;url=/companies" />
<title>Redirecting...</title>
</svelte:head>
<p>Redirecting to <a href="/companies">/companies</a></p>