migration to SvelteKit 2

This commit is contained in:
nemunaire 2024-01-09 10:26:26 +01:00
parent 7ff90f91bd
commit 61394bfc0b
10 changed files with 22 additions and 21 deletions

View File

@ -12,8 +12,9 @@
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@sveltejs/adapter-static": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"@sveltejs/adapter-static": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.16.0",
@ -26,7 +27,7 @@
"svelte-preprocess": "^5.0.3",
"tslib": "^2.3.1",
"typescript": "^5.0.0",
"vite": "^4.0.0"
"vite": "^5.0.0"
},
"type": "module",
"dependencies": {
@ -39,4 +40,4 @@
"sveltekit-i18n": "^2.2.2",
"sveltestrap": "^5.10.0"
}
}
}

View File

@ -33,7 +33,7 @@ export const load: Load = async({ parent }) => {
// If not connected, redirect to main website in the right language
if (!get_store_value(userSession)) {
const initLocale = locale.get() || window.navigator.language || window.navigator.languages[0] || tsConfig.fallbackLocale;
throw redirect(302, '/' + initLocale);
redirect(302, '/' + initLocale);
}
await refreshDomains();

View File

@ -11,17 +11,17 @@ export const load: Load = async({ parent, params }) => {
if (!get_store_value(domains)) await refreshDomains();
if (!params.dn) {
throw error(404, {
message: 'Domain not found',
});
error(404, {
message: 'Domain not found',
});
}
const domain: DomainInList | null = get_store_value(domains_idx)[params.dn];
if (!domain) {
throw error(404, {
message: 'Domain not found',
});
error(404, {
message: 'Domain not found',
});
}
let historyid = undefined;

View File

@ -11,7 +11,7 @@ export const load: Load = async({ parent, params }) => {
const domain = data.domain;
if (!domain.zone_history || domain.zone_history.length === 0) {
throw redirect(307, `/domains/${data.domain.domain}/import_zone`);
redirect(307, `/domains/${data.domain.domain}/import_zone`);
}
let definedhistory = true;
@ -23,9 +23,9 @@ export const load: Load = async({ parent, params }) => {
const zhidx = domain.zone_history.indexOf(params.historyid);
if (zhidx < 0) {
throw error(404, {
message: 'Zone not found in history'
});
error(404, {
message: 'Zone not found in history'
});
}
const zoneId: string = domain.zone_history[zhidx];

View File

@ -23,5 +23,5 @@ import { redirect } from '@sveltejs/kit';
import type { Load } from '@sveltejs/kit';
export const load: Load = async() => {
throw redirect(302, '/join');
redirect(302, '/join');
}

View File

@ -23,5 +23,5 @@ import { redirect } from '@sveltejs/kit';
import type { Load } from '@sveltejs/kit';
export const load: Load = async() => {
throw redirect(302, '/join');
redirect(302, '/join');
}

View File

@ -28,7 +28,7 @@ export const load: Load = async({ parent }) => {
const data = await parent();
if (get_store_value(userSession) != null) {
throw redirect(302, '/');
redirect(302, '/');
}
return data;

View File

@ -28,7 +28,7 @@ export const load: Load = async({ parent }) => {
const data = await parent();
if (get_store_value(userSession) != null) {
throw redirect(302, '/');
redirect(302, '/');
}
return data;

View File

@ -25,7 +25,7 @@ import { getProvider } from '$lib/api/provider';
export const load: Load = async({ params }) => {
if (params.prvid == undefined) {
throw redirect(302, '/providers/');
redirect(302, '/providers/');
}
return {

View File

@ -25,7 +25,7 @@ import { getProvider } from '$lib/api/provider';
export const load: Load = async({ params }) => {
if (params.prvid == undefined) {
throw redirect(302, '/providers/');
redirect(302, '/providers/');
}
return {