feat: 封装了接口请求的工具与获取微信授权码的方法
This commit is contained in:
23
manager/LoginManager.js
Normal file
23
manager/LoginManager.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { login } from "../request/api/Index";
|
||||
|
||||
import { getWeChatAuthCode } from "./AuthManager";
|
||||
|
||||
export async function loginAuth() {
|
||||
try {
|
||||
const openIdCode = '0f1XVM100D5JCU1BP6400WQQFD2XVM1T'// await getWeChatAuthCode();
|
||||
console.log('获取到的微信授权code:', openIdCode);
|
||||
const response = await login({
|
||||
openIdCode,
|
||||
grant_type: 'wechat',
|
||||
scope: 'server',
|
||||
clientId: '1'
|
||||
});
|
||||
if (response.success) {
|
||||
return response.data;
|
||||
} else {
|
||||
throw new Error(response.message || '登录失败');
|
||||
}
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user