Merge "Use baseUrl
for auth-check api"
This commit is contained in:
@@ -39,6 +39,10 @@
|
|||||||
this._last_auth_check_time = Date.now();
|
this._last_auth_check_time = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get baseUrl() {
|
||||||
|
return Gerrit.BaseUrlBehavior.getBaseUrl();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if user is authed or not.
|
* Returns if user is authed or not.
|
||||||
*
|
*
|
||||||
@@ -49,7 +53,7 @@
|
|||||||
(Date.now() - this._last_auth_check_time > MAX_AUTH_CHECK_WAIT_TIME_MS)
|
(Date.now() - this._last_auth_check_time > MAX_AUTH_CHECK_WAIT_TIME_MS)
|
||||||
) {
|
) {
|
||||||
// Refetch after last check expired
|
// Refetch after last check expired
|
||||||
this._authCheckPromise = fetch('/auth-check');
|
this._authCheckPromise = fetch(`${this.baseUrl}/auth-check`);
|
||||||
this._last_auth_check_time = Date.now();
|
this._last_auth_check_time = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +213,7 @@
|
|||||||
|
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
params.push(`access_token=${accessToken}`);
|
params.push(`access_token=${accessToken}`);
|
||||||
const baseUrl = Gerrit.BaseUrlBehavior.getBaseUrl();
|
const baseUrl = this.baseUrl;
|
||||||
const pathname = baseUrl ?
|
const pathname = baseUrl ?
|
||||||
url.substring(url.indexOf(baseUrl) + baseUrl.length) : url;
|
url.substring(url.indexOf(baseUrl) + baseUrl.length) : url;
|
||||||
if (!pathname.startsWith('/a/')) {
|
if (!pathname.startsWith('/a/')) {
|
||||||
|
Reference in New Issue
Block a user