import request from "@/utils/request";
import qs from "qs";

export function loginByUsername(username, password) {
    return request({
        url: "/login",
        method: "get",
        params: {
            username,
            password
        }
    });
}

export function logout(params) {
    return request({
        url: "/logout",
        method: "get",
        params
    });
}

export function getUserInfo(params) {
    return request({
        url: `/user/info`,
        method: "get",
        params
    });
}

export function getPermissions(token) {
    return request({
        url: "/user/permissions",
        method: "get",
        params: { token }
    });
}

export function getOAuthTokeByCode(params) {
    return request({
        url: "/oauth/token",
        method: "post",
        data: qs.stringify(params)
    });
}
