import axios from "axios"; import * as other from "@/utils/other"; import {HOST} from "@/utils/request"; const FORM_CONTENT_TYPE = 'application/x-www-form-urlencoded'; export const login = (data: any) => { const basicAuth = 'Basic ' + window.btoa(import.meta.env.VITE_PWD_ENC_KEY); let encPassword = data.password; encPassword = other.encryption(data.password, "thanks,rax"); data.grant_type = 'password'; data.scope = 'server'; return axios.request({ url: '/api/admin/oauth2/token', method: 'post', data: {...data, password: encPassword}, headers: { skipToken: true, Authorization: basicAuth, 'Content-Type': FORM_CONTENT_TYPE, }, }); };