client/src/app/service/fetch.js (5 lines of code) (raw):

import * as spaceAuth from "./spaceAuth"; export default async function fetchFromServer(path, method) { const httpMethod = method === undefined ? 'GET' : method; return await fetch(path, {method: httpMethod, headers: {"Authorization": "Bearer " + spaceAuth.getUserToken()}}); }