3d779734c3
* search bar function * Fixes #231, adds searchbar to sketchlist * Fixes #231, update requested changes to searchbar * Fixes #231, reset search term after modal closed
38 lines
669 B
JavaScript
38 lines
669 B
JavaScript
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
|
|
};
|
|
}
|
|
|
|
export function setSearchTerm(searchTerm) {
|
|
return {
|
|
type: ActionTypes.SET_SEARCH_TERM,
|
|
query: searchTerm
|
|
};
|
|
}
|
|
|
|
export function resetSearchTerm() {
|
|
return setSearchTerm('');
|
|
}
|