export type CreateApiApiV1UResetPasswordArgs = {'Api-Key': string, 'Api-Secret': string, body: {email: string, code: string, password: string, repassword: string}}; export type CreateApiApiV1UResetPasswordOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reset mật khẩu * * POST /api/v1/u/reset-password */ export const createApiApiV1UResetPassword = async (args: CreateApiApiV1UResetPasswordArgs, options?: CreateApiApiV1UResetPasswordOptions) => { const {baseUrl = "http://baovothuat.net", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/x-www-form-urlencoded") headers.set('accept', "application/x-www-form-urlencoded;charset=utf-8;") if (args['Api-Key'] != null) headers.set("Api-Key", String(args['Api-Key'])) if (args['Api-Secret'] != null) headers.set("Api-Secret", String(args['Api-Secret'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/u/reset-password${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: new URLSearchParams(Object.entries(args.body).flatMap(([key, value]) => (value == null ? [] : [[key, String(value)]])))}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };