import { GET, POST, PUT, Delete } from "@/utils/request";

export const GetUserInfo = (data) => {
  return GET("/permission/user/login",data);
};

export const SameUserOnline = (data) => {
  return GET("/permission/user/sameUserOnline",data);
};

export const ForceLogin = (data) => {
  return GET("/permission/user/forceLogin",data);
};

export const Logout = () => {
  return GET("/permission/user/logout", {});
};

export const invalidToken = (token) => {
  return POST("/permission/user/invalidToken", {token} , true);
};

export const ChangeUserStatus = (data) => {
  return PUT(`/permission/user/${data.id}/status`, {status: data.status}, true);
};

export const GetUserList = (data) => {
  return GET("/permission/user/list",data);
};

export const GetRoleList = (data) => {
  return GET("/permission/role/list",data);
};

export const DeleteRole = (id) => {
  return Delete(`/permission/role/${id}`, {});
};

export const GetResourceView = (data) => {
  return GET("/permission/resource/view",data);
};

export const GetRoleItems = (data) => {
  return GET("/permission/role/item",data);
};

export const GetResourceItems = (data) => {
  return GET("/permission/resource/item",data);
};
export const GetRoleTree = (data) => {
  return GET("/permission/role/tree",data);
};

export const AddResource = (data) => {
  return POST("/permission/resource/add",data,true);
};

export const AddRole = (data) => {
  return POST("/permission/role/add", data, true);
};
