feat: return not found. on /setup if already completed

This commit is contained in:
Elias Schneider
2026-04-19 20:13:19 +02:00
parent a0cb574313
commit 444f7ff2b0
6 changed files with 64 additions and 16 deletions

View File

@@ -123,6 +123,10 @@ export default class UserService extends APIService {
return res.data as User;
};
checkInitialUserSetupAvailable = async () => {
await this.api.get('/signup/setup');
};
listSignupTokens = async (options?: ListRequestOptions) => {
const res = await this.api.get('/signup-tokens', { params: options });
return res.data as Paginated<SignupToken>;

View File

@@ -0,0 +1,18 @@
import { error } from '@sveltejs/kit';
import UserService from '$lib/services/user-service';
import { AxiosError } from 'axios';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
const userService = new UserService();
try {
await userService.checkInitialUserSetupAvailable();
} catch (e) {
if (e instanceof AxiosError && e.response?.status === 404) {
error(404, 'Not found');
}
throw e;
}
};