Skip to content

Commit 7bac088

Browse files
coolspjuanpicado
authored andcommitted
fix: fixed failed to load all packages after login (conventional-changelog#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().
1 parent d5d6bd7 commit 7bac088

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/webui/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ export default class App extends Component {
120120
const { username, token, error } = await makeLogin(usernameValue, passwordValue);
121121

122122
if (username && token) {
123-
this.setLoggedUser(username, token);
124123
storage.setItem('username', username);
125124
storage.setItem('token', token);
125+
this.setLoggedUser(username, token);
126126
}
127127

128128
if (error) {

0 commit comments

Comments
 (0)