migration to new backend

This commit is contained in:
Sean Morley
2024-07-08 11:44:39 -04:00
parent 28a5d423c2
commit 9abe9fb315
309 changed files with 21476 additions and 24132 deletions

View File

@@ -0,0 +1,30 @@
import { fail, type Actions } from '@sveltejs/kit';
const PUBLIC_SERVER_URL = process.env['PUBLIC_SERVER_URL'];
const endpoint = PUBLIC_SERVER_URL || 'http://localhost:8000';
export const actions: Actions = {
forgotPassword: async (event) => {
const formData = await event.request.formData();
const email = formData.get('email') as string | null | undefined;
if (!email) {
return fail(400, { message: 'Email is required' });
}
let res = await fetch(`${endpoint}/auth/password/reset/`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email
})
});
if (!res.ok) {
return fail(res.status, { message: await res.json() });
}
return { success: true };
}
};