LauraXia123 commented on code in PR #11812:
URL: https://github.com/apache/gravitino/pull/11812#discussion_r3567774993
##########
web-v2/web/src/app/login/page.js:
##########
@@ -28,36 +29,47 @@ import { useEffect, useState, Suspense } from 'react'
import OidcLogin from './components/OidcLogin'
import DefaultLogin from './components/DefaultLogin'
+import BasicLogin from './components/BasicLogin'
import { oauthProviderFactory } from '@/lib/auth/providers/factory'
import { resetMetalakeStore } from '@/lib/store/metalakes'
import { useAppDispatch } from '@/lib/hooks/useStore'
+import { to } from '@/lib/utils'
+import { getAuthConfigs } from '@/lib/store/auth'
+
const fonts = Roboto({ subsets: ['latin'], weight: ['400'], display: 'swap' })
const { Title } = Typography
const LoginContent = () => {
+ const router = useRouter()
const searchParams = useSearchParams()
const inactiveReason = searchParams.get('reason') === 'inactive'
const maxDurationReason = searchParams.get('reason') === 'max_duration'
+ const [authType, setAuthType] = useState(null)
const [providerType, setProviderType] = useState(null)
const dispatch = useAppDispatch()
useEffect(() => {
- const detectProviderType = async () => {
- try {
- const detectedType = await oauthProviderFactory.getProviderType()
- setProviderType(detectedType)
- } catch (error) {
- setProviderType('default') // fallback to default provider
+ const detectLoginType = async () => {
+ const [, resAuthConfigs] = await to(dispatch(getAuthConfigs()))
Review Comment:
In the initial stage of the project, getAuthConfigs() is called by default.
You can see this in the initAuth function inside the session file. Therefore,
you don’t need to call it again; just directly use authType from the store.auth
object.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]