import Vue from 'vue'
const state = {
  isConnection: false,
  taskList: [],
  connection: {}
}

const mutations = {
  setIsConnection(state, b) {
    state.isConnection = b
  },
  setTaskList(state, list) {
    for (var i = 0; i < list.length; i++) {
      state.taskList.push(list[i])
    }
  },
  setSignalR(state, r) {
    state.connection = r
  },
  clearItem(state) {
    state.taskList = []
  },
  setItem(state, task) {
    for (var i = 0; i < state.taskList.length; i++) {
      if (state.taskList[i].guid == task.guid) {
        debugger
        Vue.set(state.taskList, i, task)
      }
    }
  }
}

export default {
  namespaced: true,
  state,
  mutations
}

