44 lines
955 B
JavaScript
44 lines
955 B
JavaScript
/*
|
|
* @Author: Kane
|
|
* @Date: 2022-12-22 09:10:20
|
|
* @LastEditors: Kane
|
|
* @LastEditTime: 2023-02-03 22:04:22
|
|
* @FilePath: \IT工具综合平台\src\utils\api\info\account.js
|
|
* @Description: 登录登出相关的API。
|
|
*
|
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
|
*/
|
|
import instance from "@/utils/api/request";
|
|
import { API_URL } from "@/utils/api/config"; //所有API的地址
|
|
import router from "../../../router/index";
|
|
import store from "../../../store/index";
|
|
|
|
/**
|
|
* 登录请求函数
|
|
* @param {*} userInfo
|
|
* @returns 返回promise对象
|
|
*/
|
|
export function Login(userInfo)
|
|
{
|
|
return instance.request(
|
|
{
|
|
method: "post",
|
|
url: API_URL.URL_LOGIN,
|
|
data: userInfo,
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 退出登录
|
|
*/
|
|
export function Logout()
|
|
{
|
|
console.log(store);
|
|
|
|
window.localStorage.removeItem("token");
|
|
window.localStorage.removeItem("user_info");
|
|
|
|
router.replace("/login");
|
|
}
|