2019-06-06 21:17:33 +00:00
|
|
|
import * as ActionTypes from '../../../constants';
|
|
|
|
|
|
|
|
export const DIRECTION = {
|
|
|
|
ASC: 'ASCENDING',
|
|
|
|
DESC: 'DESCENDING'
|
|
|
|
};
|
|
|
|
|
|
|
|
export function setSorting(field, direction) {
|
|
|
|
return {
|
|
|
|
type: ActionTypes.SET_SORTING,
|
|
|
|
payload: {
|
|
|
|
field,
|
|
|
|
direction
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function resetSorting() {
|
|
|
|
return setSorting('createdAt', DIRECTION.DESC);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function toggleDirectionForField(field) {
|
|
|
|
return {
|
|
|
|
type: ActionTypes.TOGGLE_DIRECTION,
|
|
|
|
field
|
|
|
|
};
|
|
|
|
}
|
2019-08-21 18:08:08 +00:00
|
|
|
|
|
|
|
export function setSearchTerm(searchTerm) {
|
|
|
|
return {
|
|
|
|
type: ActionTypes.SET_SEARCH_TERM,
|
|
|
|
query: searchTerm
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function resetSearchTerm() {
|
|
|
|
return setSearchTerm('');
|
|
|
|
}
|