import { LoginResponse } from "@/types";

// 初始化状态
const initState = {
  userInfo: null as null | LoginResponse,
};

// 定义 action 类型
type BaseActionType = {
  type: "setUserInfo";
  payload: LoginResponse;
};

// 频道 reducer
export default function baseReducer(state = initState, action: BaseActionType) {
  switch (action.type) {
    case "setUserInfo":
      return { ...state, userInfo: action.payload };
    default:
      return state;
  }
}
