mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
wip: user component now rerenders after editing
This commit is contained in:
parent
33cc47c178
commit
a7fa55f32d
3 changed files with 20 additions and 5 deletions
|
@ -82,6 +82,16 @@ class Dashboard extends React.Component {
|
|||
});
|
||||
}
|
||||
|
||||
let files = FileStore.getState();
|
||||
|
||||
if(files.length === 0){
|
||||
AppDispatcher.dispatch({
|
||||
type: 'files/start-load',
|
||||
token: sessionToken,
|
||||
param: 'objectID=1&objectType=widget'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
console.log("here are the widgets: ");
|
||||
console.log(rawWidgets);
|
||||
|
@ -160,7 +170,7 @@ class Dashboard extends React.Component {
|
|||
sessionToken: sessionToken,
|
||||
projects: null, //ProjectStore.getState(),
|
||||
simulations: null, //SimulationStore.getState(),
|
||||
files: null, //FileStore.getState(),
|
||||
files: FileStore.getState(),
|
||||
|
||||
project: prevState.project || null,
|
||||
simulation: prevState.simulation || null,
|
||||
|
|
|
@ -55,6 +55,7 @@ class UserStore extends ReduceStore {
|
|||
|
||||
case 'users/logged-in':
|
||||
// // request logged-in user data
|
||||
|
||||
UsersDataManager.getCurrentUser(action.token, action.userid);
|
||||
|
||||
return Object.assign({}, state, { token: action.token, userid: action.userid});
|
||||
|
@ -64,7 +65,10 @@ class UserStore extends ReduceStore {
|
|||
return Object.assign({}, state, { currentUser: action.user});
|
||||
|
||||
case 'users/reload-current-user':
|
||||
return state;
|
||||
|
||||
UsersDataManager.getCurrentUser(action.token, action.userid);
|
||||
|
||||
return Object.assign({}, state, { token: action.token, userid: action.userid});
|
||||
|
||||
case 'users/current-user-error':
|
||||
// discard user token
|
||||
|
|
|
@ -71,11 +71,12 @@ class User extends Component {
|
|||
let tokenState = UserStore.getState().token;
|
||||
setTimeout(function() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'users/start-load',
|
||||
data: UserStore.getState().userid,
|
||||
type: 'users/logged-in',
|
||||
user: this.state.user,
|
||||
userid: this.state.user.id,
|
||||
token: tokenState
|
||||
});
|
||||
}.bind(this), 1000)
|
||||
}.bind(this), 0.00001)
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue