summaryrefslogtreecommitdiff
path: root/client/reducers/currentTask.js
blob: 3f9233e413b5596664094ca144c0a9b9d11baf6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { addTask } from '../actions'
import client from '../client'

const currentTask = (state = {}, action) => {
  console.log(action.type)
  switch (action.type) {
    case 'SET_CONTENT':
      return {
        ...state,
        content: action.file
      }
    case 'SET_STYLE':
      return {
        ...state,
        style: action.file
      }
    case 'SET_ALPHA':
      return {
        ...state,
        alpha: action.alpha
      }
    case 'CREATE_TASK':
      client.task.create( state ).then( (data) => {
        addTask( data )
      })

      return {
        content: null,
        style: null,
        alpha: state.alpha,
      }
//     case 'ADD_TASK':
//       return {
//         ...state
//       }
    default:
      return state
  }
}

export default currentTask