Login is false when network fails
getLoggedIn catches errors and it returns false on being logged in. Gr-router preheat getLoggedIn and we want to return result in any case Change-Id: I8454f89bced801da7e9a0f287c8fb6e2c5446dc5
This commit is contained in:
@@ -1095,6 +1095,8 @@
|
||||
getLoggedIn() {
|
||||
return this.getAccount().then(account => {
|
||||
return account != null;
|
||||
}).catch(() => {
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -494,6 +494,15 @@ limitations under the License.
|
||||
});
|
||||
});
|
||||
|
||||
test('getLoggedIn returns false when network/auth failure', done => {
|
||||
window.fetch.returns(
|
||||
Promise.reject(new Error('Failed to fetch')));
|
||||
element.getLoggedIn().then(isLoggedIn => {
|
||||
assert.isFalse(isLoggedIn);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('checkCredentials', done => {
|
||||
const responses = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user