|
|
|
@ -9,7 +9,7 @@ const load_notes = function(state, dispatch){
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const runSearch = function(state, dispatch){
|
|
|
|
|
api.post('/search', {search_term: state.search_term})
|
|
|
|
|
api.post('/search', {search_term: state.search_term, sorting: state.sorting})
|
|
|
|
|
.then(res=>{
|
|
|
|
|
dispatch({type:'update-search-results', notes: res.notes});
|
|
|
|
|
});
|
|
|
|
@ -26,6 +26,7 @@ const search_term_change_handler = function(state, dispatch, e){
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const sorting_change_handler = function(state, dispatch, e){
|
|
|
|
|
runSearch(state, dispatch);
|
|
|
|
|
dispatch({type:'update-sorting', sorting: e.target.value});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|