actions.ts 702 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 { createConstantOptionsFromQuery } from './reducer';
  7. export const updateConstantVariableOptions = (identifier: KeyedVariableIdentifier): ThunkResult<void> => {
  8. return async (dispatch) => {
  9. const { rootStateKey } = identifier;
  10. await dispatch(toKeyedAction(rootStateKey, createConstantOptionsFromQuery(toVariablePayload(identifier))));
  11. await dispatch(validateVariableSelectionState(identifier));
  12. };
  13. };