login and register designed

This commit is contained in:
2023-07-21 12:25:06 +02:00
parent 3bcf6707a3
commit 0506ab9018
8 changed files with 157 additions and 117 deletions

View File

@ -10,20 +10,12 @@ export const load: PageServerLoad = async ({ locals }) => {
export const actions: Actions = {
register: async (event) => {
const data = await event.request.formData();
const acccess_options = ["rezepte", "abrechnung", "flims"]
let enabled_access = []
acccess_options.forEach((option) => {
if(data.get(option) == 'on'){
enabled_access.push(option)
}
})
const res = await event.fetch('/api/register',
{method: 'POST',
body: JSON.stringify({
username: data.get('username'),
password: data.get('password'),
access: enabled_access,
})
}
)