mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 03:46:52 +08:00
fix check version api (#520)
This commit is contained in:
@@ -20,6 +20,16 @@ export type AppContextValue = {
|
|||||||
useSelector: typeof useSelector
|
useSelector: typeof useSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const initialLangeniusVersionInfo = {
|
||||||
|
current_env: '',
|
||||||
|
current_version: '',
|
||||||
|
latest_version: '',
|
||||||
|
release_date: '',
|
||||||
|
release_notes: '',
|
||||||
|
version: '',
|
||||||
|
can_auto_update: false,
|
||||||
|
}
|
||||||
|
|
||||||
const AppContext = createContext<AppContextValue>({
|
const AppContext = createContext<AppContextValue>({
|
||||||
apps: [],
|
apps: [],
|
||||||
mutateApps: () => { },
|
mutateApps: () => { },
|
||||||
@@ -30,15 +40,7 @@ const AppContext = createContext<AppContextValue>({
|
|||||||
},
|
},
|
||||||
mutateUserProfile: () => { },
|
mutateUserProfile: () => { },
|
||||||
pageContainerRef: createRef(),
|
pageContainerRef: createRef(),
|
||||||
langeniusVersionInfo: {
|
langeniusVersionInfo: initialLangeniusVersionInfo,
|
||||||
current_env: '',
|
|
||||||
current_version: '',
|
|
||||||
latest_version: '',
|
|
||||||
release_date: '',
|
|
||||||
release_notes: '',
|
|
||||||
version: '',
|
|
||||||
can_auto_update: false,
|
|
||||||
},
|
|
||||||
useSelector,
|
useSelector,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -57,7 +59,7 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
|
|||||||
const { data: userProfileResponse, mutate: mutateUserProfile } = useSWR({ url: '/account/profile', params: {} }, fetchUserProfile)
|
const { data: userProfileResponse, mutate: mutateUserProfile } = useSWR({ url: '/account/profile', params: {} }, fetchUserProfile)
|
||||||
|
|
||||||
const [userProfile, setUserProfile] = useState<UserProfileResponse>()
|
const [userProfile, setUserProfile] = useState<UserProfileResponse>()
|
||||||
const [langeniusVersionInfo, setLangeniusVersionInfo] = useState<LangGeniusVersionResponse>()
|
const [langeniusVersionInfo, setLangeniusVersionInfo] = useState<LangGeniusVersionResponse>(initialLangeniusVersionInfo)
|
||||||
const updateUserProfileAndVersion = async () => {
|
const updateUserProfileAndVersion = async () => {
|
||||||
if (userProfileResponse && !userProfileResponse.bodyUsed) {
|
if (userProfileResponse && !userProfileResponse.bodyUsed) {
|
||||||
const result = await userProfileResponse.json()
|
const result = await userProfileResponse.json()
|
||||||
@@ -72,7 +74,7 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
|
|||||||
updateUserProfileAndVersion()
|
updateUserProfileAndVersion()
|
||||||
}, [userProfileResponse])
|
}, [userProfileResponse])
|
||||||
|
|
||||||
if (!appList || !userProfile || !langeniusVersionInfo)
|
if (!appList || !userProfile)
|
||||||
return <Loading type='app' />
|
return <Loading type='app' />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user