mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-10 03:16:51 +08:00
chore: perfect type definition (#940)
This commit is contained in:
@@ -22,7 +22,11 @@ type IState = {
|
||||
google: boolean
|
||||
}
|
||||
|
||||
function reducer(state: IState, action: { type: string; payload: any }) {
|
||||
type IAction = {
|
||||
type: 'login' | 'login_failed' | 'github_login' | 'github_login_failed' | 'google_login' | 'google_login_failed'
|
||||
}
|
||||
|
||||
function reducer(state: IState, action: IAction) {
|
||||
switch (action.type) {
|
||||
case 'login':
|
||||
return {
|
||||
@@ -120,14 +124,14 @@ const NormalForm = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (github_error !== undefined)
|
||||
dispatch({ type: 'github_login_failed', payload: null })
|
||||
dispatch({ type: 'github_login_failed' })
|
||||
if (github)
|
||||
window.location.href = github.redirect_url
|
||||
}, [github, github_error])
|
||||
|
||||
useEffect(() => {
|
||||
if (google_error !== undefined)
|
||||
dispatch({ type: 'google_login_failed', payload: null })
|
||||
dispatch({ type: 'google_login_failed' })
|
||||
if (google)
|
||||
window.location.href = google.redirect_url
|
||||
}, [google, google])
|
||||
|
||||
Reference in New Issue
Block a user