import { ElMessage } from "element-plus";

export function responseHandle({
  code,
  message,
  logout,
  handler
}: {
  code: number;
  message: string;
  logout: any;
  handler: () => void;
}) {
  const c = Number(code);
  if (c === 0) {
    handler();
  } else if (c > 100 && c < 140) {
    logout();
  } else {
    ElMessage.error(message);
  }
}
