From abf2777b2e57943b283310592ca4878e5b67ca33 Mon Sep 17 00:00:00 2001
From: ahao <liuhaoai545@gmail.com>
Date: 星期三, 27 十二月 2023 14:28:04 +0800
Subject: [PATCH] fix 修复 页面警告
---
src/api/login.ts | 47 +++++++++++++++++++++++++----------------------
1 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/src/api/login.ts b/src/api/login.ts
index 655d6c9..100a5e9 100644
--- a/src/api/login.ts
+++ b/src/api/login.ts
@@ -3,24 +3,24 @@
import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types';
import { UserInfo } from '@/api/system/user/types';
+// pc绔浐瀹氬鎴风鎺堟潈id
+const clientId = import.meta.env.VITE_APP_CLIENT_ID;
+
/**
* @param data {LoginData}
* @returns
*/
export function login(data: LoginData): AxiosPromise<LoginResult> {
const params = {
- tenantId: data.tenantId,
- username: data.username.trim(),
- password: data.password,
- code: data.code,
- uuid: data.uuid,
- clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e',
- grantType: 'password'
+ ...data,
+ clientId: data.clientId || clientId,
+ grantType: data.grantType || 'password'
};
return request({
url: '/auth/login',
headers: {
- isToken: false
+ isToken: false,
+ isEncrypt: true
},
method: 'post',
data: params
@@ -29,13 +29,19 @@
// 娉ㄥ唽鏂规硶
export function register(data: any) {
+ const params = {
+ ...data,
+ clientId: clientId,
+ grantType: 'password'
+ };
return request({
url: '/auth/register',
headers: {
- isToken: false
+ isToken: false,
+ isEncrypt: true
},
method: 'post',
- data: data
+ data: params
});
}
@@ -54,7 +60,7 @@
*/
export function getCodeImg(): AxiosPromise<VerifyCodeResult> {
return request({
- url: '/code',
+ url: '/auth/code',
headers: {
isToken: false
},
@@ -62,23 +68,20 @@
timeout: 20000
});
}
+
/**
* 绗笁鏂圭櫥褰�
- * @param source 绗笁鏂圭櫥褰曠被鍨�
- * */
-export function socialLogin(source: string, tenantId: string, code: any, state: any): AxiosPromise<any> {
- const data = {
- socialCode: code,
- socialState: state,
- source,
- tenantId,
- clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e',
+ */
+export function callback(data: LoginData): AxiosPromise<any> {
+ const LoginData = {
+ ...data,
+ clientId: clientId,
grantType: 'social'
};
return request({
- url: '/auth/social-login',
+ url: '/auth/social/callback',
method: 'post',
- data: data
+ data: LoginData
});
}
--
Gitblit v1.9.3