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

@@ -56,7 +56,7 @@ export async function trails_search_filter(filter: TrailFilter, page: number = 1
r = await f('/api/v1/trail?' + new URLSearchParams({
expand: "category,waypoints,summit_logs,trail_share_via_trail",
filter: trailIds.map((id: Record<string, any>) => `id="${id}"`).join('||'),
filter: `'${trailIds.join(',')}'~id`,
sort: `${filter.sortOrder}${filter.sort}`
}), {
method: 'GET',
@@ -101,7 +101,7 @@ export async function trails_search_bounding_box(northEast: LatLng, southWest: L
}
r = await fetch('/api/v1/trail?' + new URLSearchParams({
filter: trailIds.map((id: Record<string, any>) => `id="${id}"`).join("||"),
filter: `'${trailIds.join(',')}'~id`,
expand: "category,waypoints,summit_logs",
sort: `+name`,
}), {

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())
}
}