-
Notifications
You must be signed in to change notification settings - Fork 33
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
base: Ivan3008/homework_6
Are you sure you want to change the base?
Conversation
src/reducers/market.js
Outdated
MOVE_ORDER_TO_FARM, | ||
DELETE_ORDER_FROM_MARKET | ||
} from 'actions/marketTypes'; | ||
|
There was a problem hiding this comment.
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; | ||
} | ||
}; |
There was a problem hiding this comment.
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;
src/reducers/market.js
Outdated
DELETE_ORDER_FROM_MARKET | ||
} from 'actions/marketTypes'; | ||
|
||
export default (state = [], action) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Перепиши эту строчку так
const orders = (state = [], action) => {
src/reducers/market.js
Outdated
import { | ||
CREATE_ORDER, | ||
MOVE_ORDER_TO_FARM, | ||
DELETE_ORDER_FROM_MARKET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
этот экшен тебе не нужен в этом месте.
src/reducers/market.js
Outdated
return state.filter(order => order.id !== action.payload); | ||
|
||
default: | ||
return state; |
There was a problem hiding this comment.
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;
}
No description provided.