|
|
@ -23,6 +23,7 @@ import { useGlobSetting } from '/@/hooks/setting'; |
|
|
|
import { isUrl, isEmpty } from '/@/utils/is'; |
|
|
|
import { isUrl, isEmpty } from '/@/utils/is'; |
|
|
|
import { h } from 'vue'; |
|
|
|
import { h } from 'vue'; |
|
|
|
import { getAuthClient } from '/@/utils'; |
|
|
|
import { getAuthClient } from '/@/utils'; |
|
|
|
|
|
|
|
import { merge } from 'lodash-es'; |
|
|
|
|
|
|
|
|
|
|
|
interface UserState { |
|
|
|
interface UserState { |
|
|
|
userInfo: Nullable<User>; |
|
|
|
userInfo: Nullable<User>; |
|
|
@ -114,11 +115,13 @@ export const useUserStore = defineStore({ |
|
|
|
const { goHome = true, clientId = '', ...loginParams } = params; |
|
|
|
const { goHome = true, clientId = '', ...loginParams } = params; |
|
|
|
// 处理自定义授权客户端
|
|
|
|
// 处理自定义授权客户端
|
|
|
|
if (clientId) { |
|
|
|
if (clientId) { |
|
|
|
const client = getAuthClient(clientId); |
|
|
|
const client = getAuthClient(clientId); |
|
|
|
!isEmpty(client) && Object.assign({}, loginParams.options, { |
|
|
|
!isEmpty(client) && merge(loginParams, { |
|
|
|
clientId: client[0], |
|
|
|
options: { |
|
|
|
clientSecret: client[1] |
|
|
|
clientId: client[0], |
|
|
|
}); |
|
|
|
clientSecret: client[1] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
const data = await login(loginParams); |
|
|
|
const data = await login(loginParams); |
|
|
|
const { access_token, refresh_token } = data; |
|
|
|
const { access_token, refresh_token } = data; |
|
|
|