export type CreateApiAuthResetPasswordArgs = {token: string}; export type CreateApiAuthResetPasswordOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Complete a password reset * * POST /auth/reset-password */ export const createApiAuthResetPassword = async (args: CreateApiAuthResetPasswordArgs, options?: CreateApiAuthResetPasswordOptions) => { const {baseUrl = "https://api.your-domain.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.token != null) query.append("token", String(args.token)) const url = `${baseUrl.replace(/\/+$/, '')}/auth/reset-password${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };