|
|
|
@ -1,10 +1,8 @@
|
|
|
|
|
import useAuthStore from '@/stores/AuthStore'
|
|
|
|
|
import { isNotEmpty } from '@/utils/commons'
|
|
|
|
|
import { Flex, Result, Spin, Typography } from 'antd'
|
|
|
|
|
import { Flex, Result, Spin } from 'antd'
|
|
|
|
|
import { useEffect } from 'react'
|
|
|
|
|
import { useNavigate, useParams } from 'react-router-dom'
|
|
|
|
|
|
|
|
|
|
const { Title } = Typography
|
|
|
|
|
import { useNavigate } from 'react-router-dom'
|
|
|
|
|
|
|
|
|
|
// 钉钉扫码开发文档:https://open.dingtalk.com/document/orgapp/obtain-identity-credentials#title-4up-u8w-5ug
|
|
|
|
|
// OAuth 登录授权回调
|
|
|
|
@ -13,7 +11,8 @@ function Callback() {
|
|
|
|
|
|
|
|
|
|
const navigate = useNavigate()
|
|
|
|
|
|
|
|
|
|
const { loginStatus, login, logout, setLoginStatus } = useAuthStore()
|
|
|
|
|
const login = useAuthStore((state) => state.login)
|
|
|
|
|
const loginStatus = useAuthStore((state) => state.loginStatus)
|
|
|
|
|
const urlSearch = new URLSearchParams(location.search)
|
|
|
|
|
|
|
|
|
|
const authCode = urlSearch.get('authCode')
|
|
|
|
@ -42,7 +41,12 @@ function Callback() {
|
|
|
|
|
</Flex>
|
|
|
|
|
)
|
|
|
|
|
} else if (loginStatus === 302) {
|
|
|
|
|
navigate('/m/conversation')
|
|
|
|
|
const isMobileApp = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) !== null
|
|
|
|
|
if (isMobileApp) {
|
|
|
|
|
navigate('/m/conversation')
|
|
|
|
|
} else {
|
|
|
|
|
navigate('/')
|
|
|
|
|
}
|
|
|
|
|
} else if (loginStatus === 403) {
|
|
|
|
|
return (
|
|
|
|
|
<Flex justify='center' align='center' gap='middle' vertical>
|
|
|
|
|