change(ui): refresh test

This commit is contained in:
Shekar Siri 2023-11-07 12:17:09 +01:00
parent 4f0f3cceaf
commit 29d5d3b592

View file

@ -80,18 +80,6 @@ export default class APIClient {
return decoded.exp < currentTime;
}
async refreshToken(): Promise<string> {
const response = await fetch('/refresh', {
method: 'GET',
headers: this.init.headers
});
const data = await response.json();
const refreshedJwt = data.jwt;
store.dispatch(setJwt(refreshedJwt));
return refreshedJwt;
}
async fetch(path: string, params?: any, options: {
clean?: boolean
} = { clean: true }): Promise<Response> {
@ -132,6 +120,19 @@ export default class APIClient {
});
}
async refreshToken(): Promise<string> {
let edp = window.env.API_EDP || window.location.origin + '/api';
const response = await fetch(edp + '/refresh', {
method: 'GET',
headers: this.init.headers
});
const data = await response.json();
const refreshedJwt = data.jwt;
store.dispatch(setJwt(refreshedJwt));
return refreshedJwt;
}
get(path: string, params?: any, options?: any): Promise<Response> {
this.init.method = 'GET';
return this.fetch(queried(path, params, options));