adds password reset

This commit is contained in:
Christian Beutel
2024-11-17 21:49:46 +01:00
parent 7c1304f159
commit b9ae01846b
30 changed files with 791 additions and 247 deletions

View File

@@ -133,5 +133,30 @@ export async function users_delete(user: User) {
if (!r.ok) {
throw new ClientResponseError(await r.json())
}
}
export async function users_reset_password(reset: { email: string }) {
const r = await fetch('/api/v1/auth/reset', {
method: 'POST',
body: JSON.stringify(reset),
})
if (r.ok) {
return await r.json();
} else {
throw new ClientResponseError(await r.json())
}
}
export async function users_confirm_reset(reset: { password: string, passwordConfirm: string, token: string }) {
const r = await fetch('/api/v1/auth/confirm-reset', {
method: 'POST',
body: JSON.stringify(reset),
})
if (r.ok) {
return await r.json();
} else {
throw new ClientResponseError(await r.json())
}
}