import request from "@/utils/request";

// 定义登录信息的类型
type LoginInfo = {
  name: string; // 用户名
  password: string; // 密码
};

export const login = (loginInfo: LoginInfo) => {
  return request({
    url: "/login",
    method: "POST",
    data: {
      name: loginInfo.name,
      password: loginInfo.password
    }
  });
};

// 定义 token 接口
type userInfo = {
  content: {
  userid: string
  name: string
}
}

export const logout = () => {
  return request({
    method: 'POST',
    url:'/logout',
  })
}

export const register = (registerInfo: { name: any; password: any; }) => {
  return request({
    url: "/register",
    method: "POST",
    data: {
      name: registerInfo.name,
      password: registerInfo.password
    }
  });
};