export async function request(endpoint, method = 'GET', options = {}) {
    const { body, token } = options;
    const headers = {};
    if (token) {
        headers.authorization = token;
    }
    const response = await fetch(endpoint, {
        method,
        headers: {
            'Content-Type': 'application/json',
            ...headers,
        },
        ...(body ? { body: JSON.stringify(body) } : null),
    });
    return {
        ok: response.ok,
        json: await response.json(),
    };
}
//# sourceMappingURL=request.js.map