export function startSearch(data) {
  return (dispatch) => {
    dispatch({ type: "START_SEARCH", query: data.value });
  };
}

export function cleanQuery() {
  return (dispatch) => {
    dispatch({ type: "CLEAN_QUERY" });
  };
}

export function finishSearch(results) {
  return (dispatch) => {
    dispatch({
      type: "FINISH_SEARCH",
      results,
    });
  };
}

export function updateSelection(data) {
  return (dispatch) => {
    dispatch({
      type: "UPDATE_SELECTION",
      title: data.result.title,
      selection: data.result,
    });
  };
}
