feat: Implement a vocabulary view

This commit is contained in:
Alexander Polynomdivision
2018-10-11 14:37:21 +02:00
parent 528c291b70
commit a902d9e8f7
7 changed files with 178 additions and 1 deletions

View File

@@ -58,6 +58,11 @@ interface IState {
showHelp: boolean;
};
vocab: {
loading: boolean;
vocab: IVocab[];
};
register: {
loading: boolean;
snackMsg: string;
@@ -126,6 +131,11 @@ const initialState: IState = {
showHelp: false,
},
vocab: {
loading: true,
vocab: [],
},
register: {
loading: false,
snackOpen: false,
@@ -313,6 +323,18 @@ export function LateinicusApp(state: IState = initialState, action: any) {
leaveDialog: action.state,
}),
});
case Actions.VOCAB_SET_LOADING:
return Object.assign({}, state, {
vocab: Object.assign({}, state.vocab, {
loading: action.state,
}),
});
case Actions.VOCAB_SET_VOCAB:
return Object.assign({}, state, {
vocab: Object.assign({}, state.vocab, {
vocab: action.vocab,
}),
});
default:
// Ignore the initialization call to the reducer. By that we can
// catch all actions that are not implemented