export type CreateApiApiPhoneResendArgs = {next?: (string | null) | undefined}; export type CreateApiApiPhoneResendOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Phone Resend * * POST /api/phone/resend */ export const createApiApiPhoneResend = async (args: CreateApiApiPhoneResendArgs, options: CreateApiApiPhoneResendOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/html") if (args.next != null) query.append("next", String(args.next)) const url = `${baseUrl.replace(/\/+$/, '')}/api/phone/resend${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 res.text() };