export type GetApiMfaVerifyErrorJsonOptions = {baseUrl?: string | undefined, bearerHttpAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Information about MFA requirements. * * GET /mfa/verify/error.json */ export const getApiMfaVerifyErrorJson = async (options?: GetApiMfaVerifyErrorJsonOptions) => { const {baseUrl = "https://passbolt.local", fetch: fetchFn = fetch, bearerHttpAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerHttpAuthentication !== undefined) headers.set('authorization', `Bearer ${bearerHttpAuthentication}`) const url = `${baseUrl.replace(/\/+$/, '')}/mfa/verify/error.json${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };