import api from "apis" ; import { AppDispatch , RootState } from "store" ; import { Issue } from "types/issue" ; import * as actionTypes from "./actionTypes" ; export const createIssue = ( issue ) => { return ( dispatch , getState ) => { api . createIssue ( issue ) ; dispatch ( loadIssues ( ) ) ; } ; } ; export const loadIssues = ( ) => { return ( dispatch , getState ) => { let data = api . loadIssues ( ) ; dispatch ( { type : actionTypes . LOADED_ISSUES , payload : data } ) ; } ; } ; export const updateIssueStatusAndPos = ( issueId , srcStatus , destStatus , srcPos , destPos ) => { return ( dispatch , getState ) => { api . updateIssueStatusAndPos ( issueId , srcStatus , destStatus , srcPos , destPos ) ; dispatch ( loadIssues ( ) ) ; } ; } ; export const updateIssuePriority = ( issue , priority ) => { return ( dispatch , getState ) => { api . updateIssuePriority ( issue . id || '' , issue . status , priority ) ; dispatch ( loadIssues ( ) ) ; } ; } ; export const updateIssueStatus = ( issue , status ) => { return ( dispatch , getState ) => { api . updateIssueStatus ( issue . id || '' , issue . status , status ) ; let data = api . loadIssues ( ) ; dispatch ( { type : actionTypes . LOADED_ISSUES , payload : data } ) ; } ; } ;