diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-11-14 07:56:56 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-11-14 08:05:36 +0100 |
| commit | 4b5597b3fe6e02f1655e6a731e83bdcdf1017d63 (patch) | |
| tree | 818580507641787380b58bdcfa7d0ed7026f4e82 /code/app/src/lib/api/password-reset-request/index.ts | |
| parent | 99b0c09a6bb984d811b63788015cfad1855b5f3c (diff) | |
| download | greatoffice-4b5597b3fe6e02f1655e6a731e83bdcdf1017d63.tar.xz greatoffice-4b5597b3fe6e02f1655e6a731e83bdcdf1017d63.zip | |
refactor: Api files always returns Response
Diffstat (limited to 'code/app/src/lib/api/password-reset-request/index.ts')
| -rw-r--r-- | code/app/src/lib/api/password-reset-request/index.ts | 21 |
1 files changed, 9 insertions, 12 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 index 9d6f0dc..53cb1d2 100644 --- a/code/app/src/lib/api/password-reset-request/index.ts +++ b/code/app/src/lib/api/password-reset-request/index.ts @@ -1,17 +1,14 @@ -import { api_base } from "$lib/configuration"; -import { http_get_async, http_post_async, type InternalFetchResponse } from "../_fetch"; +import {api_base} from "$lib/configuration"; +import {http_get_async, http_post_async} 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)); + create_request_async(username: string): Promise<Response> { + return http_get_async(api_base("_/password-reset-request/create?for_user=" + 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)); + check_request_async(publicId: string): Promise<Response> { + return http_get_async(api_base("_/password-reset-request/is-valid?id=" + publicId)); }, - 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 }); + fulfill_request_async(publicId: string, newPassword: string): Promise<Response> { + return http_post_async(api_base("_/password-reset-request/fulfill"), {id: publicId, newPassword}); }, -}
\ No newline at end of file +};
\ No newline at end of file |
