feat: Implement the new /dashboard API

This commit is contained in:
Alexander Polynomdivision
2018-09-24 18:29:29 +02:00
parent 7339e1ccac
commit 24f35be058
7 changed files with 127 additions and 143 deletions

View File

@@ -37,9 +37,7 @@ interface IState {
};
dashboard: {
loadingNL: boolean;
loadingTT: boolean;
loadingLR: boolean;
loading: boolean;
};
review: {
@@ -97,9 +95,7 @@ const initialState: IState = {
},
dashboard: {
loadingNL: true,
loadingTT: true,
loadingLR: true,
loading: true,
},
review: {
@@ -227,38 +223,26 @@ export function LateinicusApp(state: IState = initialState, action: any) {
return Object.assign({}, state, {
nextLevel: action.level,
});
case Actions.DASHBOARD_SET_NL_LOADING:
return Object.assign({}, state, {
dashboard: Object.assign({}, state.dashboard, {
loadingNL: action.state,
}),
});
case Actions.SET_TOP_TEN:
return Object.assign({}, state, {
topTen: action.topTen,
});
case Actions.DASHBOARD_SET_TT_LOADING:
return Object.assign({}, state, {
dashboard: Object.assign({}, state.dashboard, {
loadingTT: action.state,
}),
});
case Actions.SET_DID_LOGIN:
return Object.assign({}, state, {
didLogin: state,
});
case Actions.DASHBOARD_SET_LR_LOADING:
return Object.assign({}, state, {
dashboard: Object.assign({}, state.dashboard, {
loadingLR: action.state,
}),
});
case Actions.REVIEW_SET_DIALOG:
return Object.assign({}, state, {
review: Object.assign({}, state.review, {
dialogOpen: action.state,
}),
});
case Actions.DASHBOARD_SET_LOADING:
return Object.assign({}, state, {
review: Object.assign({}, state.review, {
loading: action.state,
}),
});
default:
// Ignore the initialization call to the reducer. By that we can
// catch all actions that are not implemented