better signup disable

This commit is contained in:
Sean Morley
2024-08-16 12:21:43 -04:00
parent 80883202bc
commit 9f574c8505
9 changed files with 138 additions and 69 deletions

View File

@@ -2,13 +2,25 @@ import { error, fail, redirect } from '@sveltejs/kit';
import type { Actions, PageServerLoad } from './$types';
const PUBLIC_SERVER_URL = process.env['PUBLIC_SERVER_URL'];
const serverEndpoint = PUBLIC_SERVER_URL || 'http://localhost:8000';
export const load: PageServerLoad = async (event) => {
if (event.locals.user) {
return redirect(302, '/');
}
let is_disabled = await event.fetch(`${serverEndpoint}/auth/is-registration-disabled/`);
let is_disabled_json = await is_disabled.json();
console.log(is_disabled_json);
if (is_disabled_json.is_disabled) {
return {
is_disabled: true
};
} else {
return {
is_disabled: false
};
}
};
export const actions: Actions = {
default: async (event) => {
const formData = await event.request.formData();