function dataOr
dataOr<T>(
res: Response,
fallback: T
): Promise<T>

Returns the payload of res, or fallback when the response says success: false. readFirstPage reads the profile pages' lists with it, and the profile its invitees, so that a list the server refuses shows empty rather than failing the page.

Type Parameters

Parameters

fallback: T

Return Type

Promise<T>

Throws

Error

When the body isn't JSON or isn't an envelope.

Usage

import { dataOr } from "src/utils/shared/api.ts";