adds password reset
This commit is contained in:
@@ -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`,
|
||||
}), {
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user