diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js index 396ae9016a..5545de9453 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js @@ -209,7 +209,11 @@ }, getAccount: function() { - return this._fetchSharedCacheURL('/accounts/self/detail'); + return this._fetchSharedCacheURL('/accounts/self/detail', function(resp) { + if (resp.status === 403) { + this._cache['/accounts/self/detail'] = null; + } + }.bind(this)); }, getLoggedIn: function() { @@ -231,7 +235,7 @@ }.bind(this)); }, - _fetchSharedCacheURL: function(url) { + _fetchSharedCacheURL: function(url, opt_errFn) { if (this._sharedFetchPromises[url]) { return this._sharedFetchPromises[url]; } @@ -239,7 +243,7 @@ if (this._cache[url] !== undefined) { return Promise.resolve(this._cache[url]); } - this._sharedFetchPromises[url] = this.fetchJSON(url).then( + this._sharedFetchPromises[url] = this.fetchJSON(url, opt_errFn).then( function(response) { if (response !== undefined) { this._cache[url] = response;