export type CreateApiApiPhoneVerifyArgs = {next?: (string | null) | undefined}; export type CreateApiApiPhoneVerifyOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Phone Verify Submit * * POST /api/phone/verify */ export const createApiApiPhoneVerify = async (args: CreateApiApiPhoneVerifyArgs, options: CreateApiApiPhoneVerifyOptions) => { 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/verify${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() };