/*
 * @Author: Kane
 * @Date: 2022-12-22 09:10:20
 * @LastEditors: Kane
 * @LastEditTime: 2023-01-18 21:45:12
 * @FilePath: \admin_system\src\utils\api\info\account.js
 * @Description:
 *
 * 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");
}
