diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-10-25 11:51:37 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-10-25 11:51:37 +0200 |
| commit | 0005595703b2f3f7083ce4ba19bf5770057c75bd (patch) | |
| tree | 193a897f61a9a5e566961601de4cf42ae85984a0 /code/app/src/lib/api/password-reset-request | |
| parent | 585c5c8537eb21dfc9f16108548e63d9ced3d971 (diff) | |
| download | greatoffice-0005595703b2f3f7083ce4ba19bf5770057c75bd.tar.xz greatoffice-0005595703b2f3f7083ce4ba19bf5770057c75bd.zip | |
.
Diffstat (limited to 'code/app/src/lib/api/password-reset-request')
| -rw-r--r-- | code/app/src/lib/api/password-reset-request/index.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/code/app/src/lib/api/password-reset-request/index.ts b/code/app/src/lib/api/password-reset-request/index.ts new file mode 100644 index 0000000..9d6f0dc --- /dev/null +++ b/code/app/src/lib/api/password-reset-request/index.ts @@ -0,0 +1,17 @@ +import { api_base } from "$lib/configuration"; +import { http_get_async, http_post_async, type InternalFetchResponse } from "../_fetch"; + +export const http_password_reset_request = { + create_forgot_password_request(username: string): Promise<InternalFetchResponse> { + if (!username) throw new Error("Username is empty"); + return http_get_async(api_base("_/forgot-password-requests/create?username=" + username)); + }, + check_forgot_password_request(public_id: string): Promise<InternalFetchResponse> { + if (!public_id) throw new Error("Id is empty"); + return http_get_async(api_base("_/forgot-password-requests/is-valid?id=" + public_id)); + }, + fulfill_forgot_password_request(public_id: string, newPassword: string): Promise<InternalFetchResponse> { + if (!public_id) throw new Error("Id is empty"); + return http_post_async(api_base("_/forgot-password-requests/fulfill"), { id: public_id, newPassword }); + }, +}
\ No newline at end of file |
