refactor: Remove lookedAt
This commit is contained in:
parent
30a2b11ab7
commit
4fd1c6724b
@ -53,14 +53,6 @@ export function setUser(user: IUser) {
|
||||
};
|
||||
}
|
||||
|
||||
export const LEVEL_SET_LOOKEDAT = "LEVEL_SET_LOOKEDAT";
|
||||
export function setLevelLookedAt(ids: number[]) {
|
||||
return {
|
||||
type: LEVEL_SET_LOOKEDAT,
|
||||
lookedAt: ids,
|
||||
};
|
||||
};
|
||||
|
||||
export const LEVEL_SET_CUR_VOCAB = "LEVEL_SET_CUR_VOCAB";
|
||||
export function setLevelCurrentVocab(vocab: IVocab) {
|
||||
return {
|
||||
|
@ -11,13 +11,12 @@ import LevelPage from "../pages/level";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const {
|
||||
currentVocab, lookedAt, vocab, loading, stepper,
|
||||
currentVocab, vocab, loading, stepper,
|
||||
reviewDialog, leaveDialog
|
||||
} = state.level;
|
||||
|
||||
return {
|
||||
currentVocab,
|
||||
lookedAt,
|
||||
vocab,
|
||||
loading,
|
||||
stepperIndex: stepper,
|
||||
@ -29,7 +28,6 @@ const mapStateToProps = state => {
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
drawerButtonState: (state: boolean) => dispatch(setDrawerButton(state)),
|
||||
setLookedAt: (ids: number[]) => dispatch(setLevelLookedAt(ids)),
|
||||
setCurrentVocab: (vocab: IVocab) => dispatch(setLevelCurrentVocab(vocab)),
|
||||
setVocab: (vocab: IVocab[]) => dispatch(setLevelVocab(vocab)),
|
||||
setLoading: (state: boolean) => dispatch(setLevelLoading(state)),
|
||||
|
@ -35,12 +35,10 @@ interface IProps {
|
||||
stepperIndex: number;
|
||||
loading: boolean;
|
||||
vocab: IVocab[];
|
||||
lookedAt: number[];
|
||||
currentVocab: IVocab;
|
||||
leaveDialog: boolean;
|
||||
reviewDialog: boolean;
|
||||
setVocab: (vocab: IVocab[]) => void;
|
||||
setLookedAt: (ids: number[]) => void;
|
||||
setCurrentVocab: (vocab: IVocab) => void;
|
||||
drawerButtonState: (state: boolean) => void;
|
||||
setLoading: (state: boolean) => void;
|
||||
@ -68,7 +66,6 @@ const LevelPageWithRouter = withRouter(
|
||||
const { vocab } = data;
|
||||
this.props.setVocab(vocab);
|
||||
this.props.setCurrentVocab(vocab[0]);
|
||||
this.props.setLookedAt([vocab[0].id]);
|
||||
this.props.setStepper(0);
|
||||
this.props.setLoading(false);
|
||||
});
|
||||
|
@ -27,7 +27,6 @@ interface IState {
|
||||
|
||||
level: {
|
||||
currentVocab: IVocab;
|
||||
lookedAt: number[];
|
||||
vocab: IVocab[];
|
||||
loading: boolean;
|
||||
stepper: number;
|
||||
@ -104,7 +103,6 @@ const initialState: IState = {
|
||||
|
||||
level: {
|
||||
currentVocab: {} as IVocab,
|
||||
lookedAt: [0],
|
||||
vocab: [],
|
||||
loading: true,
|
||||
stepper: 0,
|
||||
@ -194,12 +192,6 @@ export function LateinicusApp(state: IState = initialState, action: any) {
|
||||
return Object.assign({}, state, {
|
||||
user: action.user,
|
||||
});
|
||||
case Actions.LEVEL_SET_LOOKEDAT:
|
||||
return Object.assign({}, state, {
|
||||
level: Object.assign({}, state.level, {
|
||||
lookedAt: action.lookedAt,
|
||||
}),
|
||||
});
|
||||
case Actions.LEVEL_SET_CUR_VOCAB:
|
||||
return Object.assign({}, state, {
|
||||
level: Object.assign({}, state.level, {
|
||||
|
Reference in New Issue
Block a user