Fixes prerender error

This commit is contained in:
freearhey 2023-10-10 10:27:20 +03:00
parent 48bb117276
commit f405657e2f
2 changed files with 15 additions and 9 deletions

View file

@ -1,9 +0,0 @@
import { redirect } from '@sveltejs/kit'
export function load({ url }) {
const id = url.searchParams.get('id')
const [name, country] = id.split('.')
const redirectUrl = `/channels/${country}/${name}`
throw redirect(302, redirectUrl)
}

View file

@ -0,0 +1,15 @@
<script>
import { redirect } from '@sveltejs/kit'
import { page } from '$app/stores'
import { onMount } from 'svelte'
onMount(() => {
const id = $page.url.searchParams.get('id')
const [name, country] = id.split('.')
const redirectUrl = `/channels/${country}/${name}`
window.location.replace(redirectUrl)
})
</script>
Redirecting...