Skip to content

Commit

Permalink
fix: fixed failed to load all packages after login (conventional-chan…
Browse files Browse the repository at this point in the history
…gelog#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().
  • Loading branch information
coolsp authored and juanpicado committed Jun 10, 2019
1 parent d5d6bd7 commit 7bac088
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/webui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7bac088

Please sign in to comment.