mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 13:04:57 +08:00
26 lines
747 B
TypeScript
26 lines
747 B
TypeScript
![]() |
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,
|
||
|
},
|
||
|
});
|
||
|
};
|