f
This commit is contained in:
@@ -68,3 +68,41 @@ export async function uploadAvatar(payload: UploadAvatarPayload): Promise<MeResp
|
||||
if (!res.ok) throw data
|
||||
return data
|
||||
}
|
||||
|
||||
export async function passwordResetStart(): Promise<void> {
|
||||
const csrf = await getCsrfToken()
|
||||
const res = await fetch(`${USERS_API_URL}/me/settings/password/start`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'X-CSRF-Token': csrf,
|
||||
},
|
||||
})
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}))
|
||||
throw data
|
||||
}
|
||||
}
|
||||
|
||||
export interface PasswordResetCompletePayload {
|
||||
code: string
|
||||
new_password: string
|
||||
confirm_password: string
|
||||
}
|
||||
|
||||
export async function passwordResetComplete(payload: PasswordResetCompletePayload): Promise<void> {
|
||||
const csrf = await getCsrfToken()
|
||||
const res = await fetch(`${USERS_API_URL}/me/settings/password/complete`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-Token': csrf,
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}))
|
||||
throw data
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user