change(ui): refresh test
This commit is contained in:
parent
4f0f3cceaf
commit
29d5d3b592
1 changed files with 13 additions and 12 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue