diff --git a/materialious/src/routes/playlist/+page.ts b/materialious/src/routes/playlist/+page.ts new file mode 100644 index 00000000..f7c0637b --- /dev/null +++ b/materialious/src/routes/playlist/+page.ts @@ -0,0 +1,11 @@ +import { goto } from '$app/navigation'; +import { error } from '@sveltejs/kit'; + +export async function load({ url }) { + const playlistId = url.searchParams.get('list'); + if (playlistId) { + goto(`/playlist/${playlistId}`); + } else { + error(404); + } +} \ No newline at end of file diff --git a/materialious/src/routes/watch/+page.ts b/materialious/src/routes/watch/+page.ts new file mode 100644 index 00000000..da580155 --- /dev/null +++ b/materialious/src/routes/watch/+page.ts @@ -0,0 +1,17 @@ +import { goto } from '$app/navigation'; +import { error } from '@sveltejs/kit'; + +export async function load({ url }) { + const videoId = url.searchParams.get('v'); + const playlistId = url.searchParams.get('list'); + if (videoId) { + let goToUrl = `/watch/${videoId}`; + + if (playlistId) { + goToUrl += `?playlist=${playlistId}`; + } + goto(goToUrl); + } else { + error(404); + } +} \ No newline at end of file