Choices/assets/scripts/src/actions/index.js

40 lines
792 B
JavaScript
Raw Normal View History

2016-04-14 15:43:36 +02:00
export const addItem = (value, id, optionId) => {
2016-03-30 16:04:21 +02:00
return {
type: 'ADD_ITEM',
value: value,
2016-04-14 15:43:36 +02:00
id: parseInt(id),
optionId: parseInt(optionId)
2016-03-30 16:04:21 +02:00
}
};
2016-03-30 16:04:21 +02:00
2016-04-14 15:43:36 +02:00
export const removeItem = (id, optionId) => {
2016-03-30 16:04:21 +02:00
return {
type: 'REMOVE_ITEM',
2016-04-14 15:43:36 +02:00
id: parseInt(id),
optionId: parseInt(optionId)
2016-03-30 16:04:21 +02:00
}
};
2016-03-30 16:04:21 +02:00
export const selectItem = (id, selected) => {
2016-03-30 16:04:21 +02:00
return {
type: 'SELECT_ITEM',
2016-04-14 15:43:36 +02:00
id: parseInt(id),
selected: selected,
2016-03-30 16:04:21 +02:00
}
2016-04-12 15:31:07 +02:00
};
export const addOption = (value, id) => {
return {
type: 'ADD_OPTION',
value: value,
2016-04-14 15:43:36 +02:00
id: parseInt(id),
}
};
export const selectOption = (id, selected) => {
return {
type: 'SELECT_OPTION',
2016-04-14 15:43:36 +02:00
id: parseInt(id),
selected: selected,
2016-04-12 15:31:07 +02:00
}
};