Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ivan3008/homework 6 - черновик #181

Open
wants to merge 3 commits into
base: Ivan3008/homework_6
Choose a base branch
from

Conversation

Ivan3008
Copy link

No description provided.

MOVE_ORDER_TO_FARM,
DELETE_ORDER_FROM_MARKET
} from 'actions/marketTypes';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно добавить
import { combineReducers } from 'redux';

default:
return state;
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Потребуется вот это

export default combineReducers({
    orders
});

export const getMarketOrders = state => state.market.orders;

DELETE_ORDER_FROM_MARKET
} from 'actions/marketTypes';

export default (state = [], action) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Перепиши эту строчку так
const orders = (state = [], action) => {

import {
CREATE_ORDER,
MOVE_ORDER_TO_FARM,
DELETE_ORDER_FROM_MARKET
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

этот экшен тебе не нужен в этом месте.

return state.filter(order => order.id !== action.payload);

default:
return state;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Код свитча сверь с этим:

    switch (action.type) {
        case CREATE_ORDER:
            const { payload } = action;
            return [...state, payload];
        case MOVE_ORDER_TO_FARM:
            const { id } = action.payload;
            return state.filter(order => order.id !== id);
        default:
            return state;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants