mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-04 04:07:47 +08:00
fix: hook dependency (#4242)
This commit is contained in:
parent
370e1c1a17
commit
00ce372b71
@ -5,13 +5,11 @@ import { useRouter } from 'next/navigation'
|
|||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { useContext } from 'use-context-selector'
|
|
||||||
import Toast from '../components/base/toast'
|
import Toast from '../components/base/toast'
|
||||||
import style from './page.module.css'
|
import style from './page.module.css'
|
||||||
import { IS_CE_EDITION, apiPrefix } from '@/config'
|
import { IS_CE_EDITION, apiPrefix } from '@/config'
|
||||||
import Button from '@/app/components/base/button'
|
import Button from '@/app/components/base/button'
|
||||||
import { login, oauth } from '@/service/common'
|
import { login, oauth } from '@/service/common'
|
||||||
import I18n from '@/context/i18n'
|
|
||||||
import { getPurifyHref } from '@/utils'
|
import { getPurifyHref } from '@/utils'
|
||||||
const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$/
|
const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$/
|
||||||
|
|
||||||
@ -65,7 +63,6 @@ function reducer(state: IState, action: IAction) {
|
|||||||
const NormalForm = () => {
|
const NormalForm = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { locale } = useContext(I18n)
|
|
||||||
|
|
||||||
const [state, dispatch] = useReducer(reducer, {
|
const [state, dispatch] = useReducer(reducer, {
|
||||||
formValid: false,
|
formValid: false,
|
||||||
@ -96,7 +93,6 @@ const NormalForm = () => {
|
|||||||
remember_me: true,
|
remember_me: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if (res.result === 'success') {
|
if (res.result === 'success') {
|
||||||
localStorage.setItem('console_token', res.data)
|
localStorage.setItem('console_token', res.data)
|
||||||
router.replace('/apps')
|
router.replace('/apps')
|
||||||
@ -143,7 +139,7 @@ const NormalForm = () => {
|
|||||||
dispatch({ type: 'google_login_failed' })
|
dispatch({ type: 'google_login_failed' })
|
||||||
if (google)
|
if (google)
|
||||||
window.location.href = google.redirect_url
|
window.location.href = google.redirect_url
|
||||||
}, [google, google])
|
}, [google, google_error])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user