client/api: fix cache not cleared on login

This led to weird anomalies when logging with valid password and then
with invalid one.
This commit is contained in:
rr- 2016-06-19 21:37:44 +02:00
parent 2651cbb374
commit d5c3d21951

View file

@ -122,6 +122,7 @@ class Api extends events.EventTarget {
} }
login(userName, userPassword, doRemember) { login(userName, userPassword, doRemember) {
this.cache = {};
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.userName = userName; this.userName = userName;
this.userPassword = userPassword; this.userPassword = userPassword;
@ -138,7 +139,7 @@ class Api extends events.EventTarget {
this.user = response; this.user = response;
resolve(); resolve();
this.dispatchEvent(new CustomEvent('login')); this.dispatchEvent(new CustomEvent('login'));
}).catch(response => { }, response => {
reject(response.description); reject(response.description);
this.logout(); this.logout();
}); });