import { Task } from '../types/google' ; export const RECEIVE_TASKS = 'RECEIVE_TASKS' ; export const UPDATE_TASK = 'UPDATE_TASK' ; export const DELETE_TASK = 'DELETE_TASK' ; export const INSERT_TASK = 'INSERT_TASK' ; export const UPDATE_TASK_COMPLETION = 'UPDATE_TASK_COMPLETION' ; export type TasksAction = { type : string ; payload : Task [ ] ; } ; export type TaskAction = { type : string ; payload : Task ; } ; export type UpdateTaskCompletionAction = { type : string ; task : string ; taskList : string ; completed : boolean ; } ; export type DeleteTaskAction = { type : string ; task : string ; taskList : string ; parent : string ; } ; export function receiveTasksAction ( tasks ) { return { type : RECEIVE_TASKS , payload : tasks , } ; } export function updateTaskCompletionAction ( task , taskList , completed ) { return { type : UPDATE_TASK_COMPLETION , task , taskList , completed , } ; } export function updateTaskAction ( task ) { return { type : UPDATE_TASK , payload : task , } ; } export function insertTaskAction ( task ) { return { type : INSERT_TASK , payload : task , } ; } export function deleteTaskAction ( task , taskList , parent ) { return { type : DELETE_TASK , task , taskList , parent , } ; } export type Action = TasksAction | TaskAction | UpdateTaskCompletionAction | DeleteTaskAction ;