export async function fetchFromSpace()

in space-slack-sync/client/src/app/service/fetch.ts [16:24]


export async function fetchFromSpace<T>(path: string): Promise<T> {
    let spaceServerUrl = spaceAuth.getSpaceServerUrl();
    if (spaceServerUrl == null) {
        throw `Request ${path} cannot be made: space server url is absent`;
    }

    const response = await fetch(spaceServerUrl + path, { headers: { "Authorization": "Bearer " + spaceAuth.getUserToken() } });
    return response.json();
}