export type ResetPasswordInput = {newPassword: string, newPasswordConfirm: string}; export type PatchApiSuperuserResetPasswordResetTokenArgs = {resetToken: string, body: ResetPasswordInput}; export type PatchApiSuperuserResetPasswordResetTokenOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Concludes password reset process * * PATCH /superuser/reset-password/{resetToken} */ export const patchApiSuperuserResetPasswordResetToken = async (args: PatchApiSuperuserResetPasswordResetTokenArgs, options?: PatchApiSuperuserResetPasswordResetTokenOptions) => { const {baseUrl = "https://api.brla.digital:5567/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/superuser/reset-password/${encodeURIComponent(String(args.resetToken))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };