mon-entreprise/source/actions/actions.js

50 lines
1.1 KiB
JavaScript
Raw Normal View History

/* @flow */
import type {
ResetSimulationAction,
LoadPreviousSimulationAction,
DeletePreviousSimulationAction,
StartConversationAction
2018-07-12 08:09:41 +00:00
} from 'Types/ActionsTypes'
import { deletePersistedSimulation } from '../storage/persistSimulation'
export function resetSimulation(): ResetSimulationAction {
return {
type: 'RESET_SIMULATION'
}
}
export const deletePreviousSimulation = () => (
dispatch: DeletePreviousSimulationAction => void
) => {
dispatch({
type: 'DELETE_PREVIOUS_SIMULATION'
})
deletePersistedSimulation()
}
export function startConversation(
priorityNamespace: ?string
): StartConversationAction {
return {
type: 'START_CONVERSATION',
...(priorityNamespace ? { priorityNamespace } : {})
}
}
// $FlowFixMe
export function setExample(name, situation, dottedName) {
return { type: 'SET_EXAMPLE', name, situation, dottedName }
}
export function loadPreviousSimulation(): LoadPreviousSimulationAction {
return {
type: 'LOAD_PREVIOUS_SIMULATION'
}
}
2018-10-02 16:14:01 +00:00
export function hideControl(id: string) {
return { type: 'HIDE_CONTROL', id }
}
export const EXPLAIN_VARIABLE = 'EXPLAIN_VARIABLE'