From 7bac0886ebf8fe0e585bdca033b7881f96b85d2c Mon Sep 17 00:00:00 2001 From: coolsp Date: Mon, 10 Jun 2019 11:49:18 +0200 Subject: [PATCH] fix: fixed failed to load all packages after login (#73) 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 a546068..b76f131 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) {