Spaces:
Runtime error
Runtime error
File size: 543 Bytes
d13169e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<script>
import { onMount } from 'svelte';
import { goto } from '$app/navigation';
onMount(() => {
// Get the current URL search parameters
const params = new URLSearchParams(window.location.search);
// Check if 'v' parameter exists
if (params.has('v')) {
// Get the value of 'v' parameter
const videoId = params.get('v');
// Redirect to root with 'youtube' parameter
goto(`/?youtube=${encodeURIComponent(videoId)}`);
} else {
// Redirect to root if 'v' parameter doesn't exist
goto('/');
}
});
</script>
|