forked from sombochea/verdaccio-ui
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().
This commit is contained in:
parent
d5d6bd79ca
commit
7bac0886eb
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user