aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/lib/api/password-reset-request/index.ts
blob: 53cb1d2bcaf2c5b01ba39f21eb294ec3d6314dc7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import {api_base} from "$lib/configuration";
import {http_get_async, http_post_async} from "../_fetch";

export const http_password_reset_request = {
    create_request_async(username: string): Promise<Response> {
        return http_get_async(api_base("_/password-reset-request/create?for_user=" + username));
    },
    check_request_async(publicId: string): Promise<Response> {
        return http_get_async(api_base("_/password-reset-request/is-valid?id=" + publicId));
    },
    fulfill_request_async(publicId: string, newPassword: string): Promise<Response> {
        return http_post_async(api_base("_/password-reset-request/fulfill"), {id: publicId, newPassword});
    },
};