import { Map, fromJS, List } from "immutable";

export function showState(
  state = Map(
    fromJS({
      loading: true,
    })
  ),
  action
) {
  // 框架在初始化state的值时，action默认带一个type小于1的随机值(即：action={type: 0.12354556435634})，这里判断小于1时返回默认值
  if (action.type && action.type < 1) return state;
  state = state.sf(["loading"], action);
  return state;
}
//视频课程列表
export function accountList(state = List(), action) {
  if (action.type && action.type < 1) return state;
  state = List(fromJS(action));
  return state;
}
//视频课程图片
export function accountImg(state = List(), action) {
  if (action.type && action.type < 1) return state;
  state = List(fromJS(action));
  return state;
}
export function accountNum(
  state = Map(
    fromJS({
      tempData: {},
    })
  ),
  action
) {
  if (action.type && action.type < 1) return state;
  state = state.sf(["tempData"], action);
  state = fromJS(state);
  return state;
}
