- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
/**
* Refresh JWT.
* @returns New tokens.
*/
static refreshToken(): Observable<BaseResponseInterface<SignInResponse>> {
const http = InjectorInstance.get<HttpClient>(HttpClient);
this.isRefreshingToken = true;
setTimeout(() => (this.isRefreshingToken = false), 15000);
return http
.post<BaseResponseInterface<SignInResponse>>(environment.API.REFRESH_TOKEN, {
accessToken: localStorage.getItem('auth_token'),
refreshToken: localStorage.getItem('refresh_token')
})
.pipe(
tap(response => {
this.isRefreshingToken = false;
this.storeTokens(response.data.token, response.data.refreshToken);
})
);
}
Когда уверен в своем сервере. Или просто сдался.