Commit a7fa55f3 authored by Laura Fuentes Grau's avatar Laura Fuentes Grau

wip: user component now rerenders after editing

parent 33cc47c1
......@@ -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)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment