Commit 1e53fdfd authored by Samir Sadyhov's avatar Samir Sadyhov 🤔

ApiClient fix auth

parent 6342dc30
this.ApiClient = class {
constructor() {
this._baseURL = `${window.location.origin}/Synergy`;
this._authHeader = this._buildAuthHeader();
this._defaultAuthHeader = this._buildDefaultAuthHeader();
this._requestInterceptors = [];
this._responseInterceptors = [];
}
async request({ url, method = 'GET', body, headers = {}, defaultUser = false }) {
let finalHeaders = this._normalizeHeaders({
authorization: defaultUser ? this._defaultAuthHeader : this._authHeader,
authorization: defaultUser ? this._buildDefaultAuthHeader() : this._buildAuthHeader(),
...headers,
});
......@@ -57,7 +54,6 @@ this.ApiClient = class {
try {
response = await fetch(config.url, config);
} catch (err) {
console.error({config, msg: err});
throw this._handleNetworkError(err);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment