mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: email resetting frontend code
This commit is contained in:
parent
15677a6946
commit
1987e56b9a
9 changed files with 451 additions and 5 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { getAPIUrl } from '@services/config/config'
|
||||
import { RequestBody, getResponseMetadata } from '@services/utils/ts/requests'
|
||||
|
||||
interface LoginAndGetTokenResponse {
|
||||
access_token: 'string'
|
||||
|
|
@ -36,6 +37,29 @@ export async function loginAndGetToken(
|
|||
return response
|
||||
}
|
||||
|
||||
export async function sendResetLink(email: string, org_id: number) {
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}users/reset_password/send_reset_code/${email}?org_id=${org_id}`,
|
||||
RequestBody('POST', null, null)
|
||||
)
|
||||
const res = await getResponseMetadata(result)
|
||||
return res
|
||||
}
|
||||
|
||||
export async function resetPassword(
|
||||
email: string,
|
||||
new_password: string,
|
||||
org_id: number,
|
||||
reset_code: string
|
||||
) {
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}users/reset_password/change_password/${email}?reset_code=${reset_code}&new_password=${new_password}&org_id=${org_id}`,
|
||||
RequestBody('POST', null, null)
|
||||
)
|
||||
const res = await getResponseMetadata(result)
|
||||
return res
|
||||
}
|
||||
|
||||
export async function logout(): Promise<any> {
|
||||
// Request Config
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue