actions.ts 696 B

12345678910111213141516
  1. import { ThunkResult } from 'app/types';
  2. import { validateVariableSelectionState } from '../state/actions';
  3. import { toKeyedAction } from '../state/keyedVariablesReducer';
  4. import { KeyedVariableIdentifier } from '../state/types';
  5. import { toVariablePayload } from '../utils';
  6. import { createCustomOptionsFromQuery } from './reducer';
  7. export const updateCustomVariableOptions = (identifier: KeyedVariableIdentifier): ThunkResult<void> => {
  8. return async (dispatch) => {
  9. const { rootStateKey } = identifier;
  10. await dispatch(toKeyedAction(rootStateKey, createCustomOptionsFromQuery(toVariablePayload(identifier))));
  11. await dispatch(validateVariableSelectionState(identifier));
  12. };
  13. };