fetch = (url, options) => {
const headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
if (this.authorized()) {
headers['Authorization'] = 'Bearer ' + this.getToken()
}
return fetch(url, {
headers,
...options
});
}
fetchJson = async (url, options) => {
let response = await this.fetch(url, options);
let json = await response.json();
return json;
}