export type GetApiAuthWelcomeOptions = {baseUrl: string, bearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Test authentication * * GET /auth/welcome */ export const getApiAuthWelcome = async (options: GetApiAuthWelcomeOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerToken !== undefined) headers.set("Authorization", bearerToken) const url = `${baseUrl.replace(/\/+$/, '')}/auth/welcome${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 };