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

66 lines
1.1 KiB
JavaScript
Raw Normal View History

export const addItem = (value, label, id, choiceId) => {
2016-03-30 16:04:21 +02:00
return {
type: 'ADD_ITEM',
value,
label,
id,
choiceId,
2016-03-30 16:04:21 +02:00
}
};
2016-03-30 16:04:21 +02:00
export const removeItem = (id, choiceId) => {
2016-03-30 16:04:21 +02:00
return {
type: 'REMOVE_ITEM',
id,
choiceId,
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',
id,
selected,
2016-03-30 16:04:21 +02:00
}
2016-04-12 15:31:07 +02:00
};
export const addChoice = (value, label, id, groupId, disabled) => {
2016-04-12 15:31:07 +02:00
return {
type: 'ADD_CHOICE',
value,
label,
id,
groupId,
disabled,
}
};
export const filterChoices = (results) => {
return {
type: 'FILTER_CHOICES',
results,
}
};
export const activateChoices = (active = true) => {
return {
2016-06-29 15:47:58 +02:00
type: 'ACTIVATE_CHOICES',
active,
}
};
export const addGroup = (value, id, active, disabled) => {
return {
type: 'ADD_GROUP',
value,
id,
active,
disabled,
}
};
export const clearAll = () => {
return {
type: 'CLEAR_ALL',
}
};