import {
  REGISTER_LIST,
  DESTROY_LIST,

  LOAD_LIST,
  LOAD_LIST_SUCCESS,
  LOAD_LIST_ERROR,
} from './actionsTypes'

export function registerList(listId, params) {
  return {
    type: REGISTER_LIST,
    payload: {
      listId,
      params,
    },
  }
}

export function destroyList(listId) {
  return {
    type: DESTROY_LIST,
    payload: {
      listId,
    },
  }
}

export function loadList(listId) {
  return {
    type: LOAD_LIST,
    payload: {
      listId,
    },
  }
}

export function loadListSuccess(listId, response) {
  return {
    type: LOAD_LIST_SUCCESS,
    payload: {
      listId,
      response,
    },
  }
}

export function loadListError(listId, response) {
  return {
    type: LOAD_LIST_ERROR,
    payload: {
      listId,
      response,
    },
  }
}

@@ -524,32 +524,283 @@
 Id, response) %7B%0A
+  if (!response) %7B%0A    throw new Error('Response is required')%0A  %7D%0A%0A  if (!response.items) %7B%0A    throw new Error('Response items is required')%0A  %7D%0A%0A  if (!(response.items instanceof Array)) %7B%0A    throw new Error('Response items should be array')%0A  %7D%0A%0A
   return %7B%0A    t

Validate response in loadListSuccess action and throw error if invalid