1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-24 06:54:27 +07:00

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:
coolsp 2019-06-10 11:49:18 +02:00 committed by Juan Picado @jotadeveloper
parent d5d6bd79ca
commit 7bac0886eb

View File

@ -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) {