From 829c4cbcb7952c453400dbe0463bc3b756c1f282 Mon Sep 17 00:00:00 2001 From: Peter Cools Date: Sun, 9 Jun 2019 12:23:36 +0200 Subject: [PATCH] fix: fixed failed to load all packages after login A login forces react to reload the list of available packages (by changing the state). However the state (which triggers react to refresh) is set before storing the login token resulting in fetching (XHR GET) only the public packages as the token is not yet available in the GET request. Fixed by setting the storage items ('username' and 'token') before this.setLoggedUser(). --- src/webui/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/app.js b/src/webui/app.js index a54606829..b76f1316a 100644 --- a/src/webui/app.js +++ b/src/webui/app.js @@ -120,9 +120,9 @@ export default class App extends Component { const { username, token, error } = await makeLogin(usernameValue, passwordValue); if (username && token) { - this.setLoggedUser(username, token); storage.setItem('username', username); storage.setItem('token', token); + this.setLoggedUser(username, token); } if (error) {