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 { 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 { 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 { if (!public_id) throw new Error("Id is empty"); return http_post_async(api_base("_/forgot-password-requests/fulfill"), { id: public_id, newPassword }); }, }