/*
 * @Author: Kane
 * @Date: 2022-12-22 09:10:20
 * @LastEditors: Kane
 * @LastEditTime: 2023-02-04 15:45:51
 * @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";

/**
 * 登录请求函数
 * @param {*} userInfo 
 * @returns 返回promise对象
 */
export function Login(userInfo)
{
    return instance.request(
        {
            method: "post",
            url: API_URL.URL_LOGIN,
            data: userInfo,
        }
    );
}

/**
 * 退出登录
 */
export function Logout()
{
    window.localStorage.removeItem("token");
    window.localStorage.removeItem("user_info");

    router.replace("/login");
}
