From d5c3d21951d08f022b7a9c4d05d7336c94ff64f9 Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 19 Jun 2016 21:37:44 +0200 Subject: [PATCH] client/api: fix cache not cleared on login This led to weird anomalies when logging with valid password and then with invalid one. --- client/js/api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/js/api.js b/client/js/api.js index 3390a660..de76119e 100644 --- a/client/js/api.js +++ b/client/js/api.js @@ -122,6 +122,7 @@ class Api extends events.EventTarget { } login(userName, userPassword, doRemember) { + this.cache = {}; return new Promise((resolve, reject) => { this.userName = userName; this.userPassword = userPassword; @@ -138,7 +139,7 @@ class Api extends events.EventTarget { this.user = response; resolve(); this.dispatchEvent(new CustomEvent('login')); - }).catch(response => { + }, response => { reject(response.description); this.logout(); });