Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIS-866: Search Communication #647

Merged
merged 17 commits into from Jan 7, 2021

move window dispatch

  • Loading branch information
fcjr committed Jan 5, 2021
commit 4f90be731548b0be5b843913f995b87bebaee1d1
@@ -44,7 +44,13 @@ class Api {
return fetch(`${this.config.AUTH_SERVER}/api/v2/refresh_token`, {
method: 'POST',
credentials: 'include',
}).finally(() => { this.isRefreshing = false; });
}).then((res) => {
this.isRefreshing = false;
window.dispatchEvent(new CustomEvent(this.tokenRefreshedEventType, {
detail: res,
}));
return res;
});
}

_sendReq(method, path, body) {
@@ -109,9 +115,6 @@ class Api {
if (shouldRefresh) {
this.refreshToken()
.then((res) => {
window.dispatchEvent(new CustomEvent(this.tokenRefreshedEventType, {
detail: res,
}));
const { status } = res;
if (status >= 400) {
res.json().then(data2 => (
ProTip! Use n and p to navigate between commits in a pull request.