rax-medical/src/api/acl/login.ts

26 lines
747 B
TypeScript
Raw Normal View History

2024-03-13 16:54:09 +08:00
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,
},
});
};