migrate to sveltekit 2

This commit is contained in:
Xylight committed 2024-02-10 16:01:04 -08:00
1 parent ff52be7f34
commit a7c1e2a21f
11 files changed
+21 -20

No files matched your search

+1 -1
View File
@@ -47,7 +47,7 @@ async function customFetch(
if (auth && url) url.searchParams.set('auth', auth)
const res = await f(url ?? input, init)
if (!res.ok) throw error(res.status, await res.text())
if (!res.ok) error(res.status, await res.text());
return res
}
+3 -3
View File
@@ -39,8 +39,8 @@ export async function load({ url, fetch }) {
},
}
} catch (err) {
throw error(500, {
message: 'Failed to fetch homepage.',
})
error(500, {
message: 'Failed to fetch homepage.',
});
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit'
export const load = () => {
throw redirect(300, '/admin/config')
redirect(300, '/admin/config');
}
+1 -1
View File
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit'
export function load({ params }) {
// If you somehow got to /comment/instance, it likely means you passed in an ID, not an instance.
throw redirect(300, `/comment/${getInstance()}/${params.instance}`)
redirect(300, `/comment/${getInstance()}/${params.instance}`);
}
+4 -4
View File
@@ -8,8 +8,8 @@ export async function load({ params, fetch }) {
id: Number(params.id),
})
throw redirect(
300,
`/post/${params.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}`
)
redirect(
300,
`/post/${params.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}`
);
}
+2 -2
View File
@@ -12,8 +12,8 @@ export function load({ params, url }) {
const newUrl = new URL(url)
newUrl.pathname = split.join('/')
throw redirect(300, newUrl.toString())
redirect(300, newUrl.toString());
}
throw error(404, 'Not found')
error(404, 'Not found');
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit'
export const load = async () => {
throw redirect(300, '/profile/user')
redirect(300, '/profile/user');
}
+1 -1
View File
@@ -3,6 +3,6 @@ import { redirect } from "@sveltejs/kit";
export const load = () => {
if (LINKED_INSTANCE_URL) {
throw redirect(300, `/signup/${LINKED_INSTANCE_URL}`)
redirect(300, `/signup/${LINKED_INSTANCE_URL}`);
}
}