You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gcgj-dify-1.7.0/web/app/(shareLayout)/components/authenticated-layout.tsx

31 lines
851 B
TypeScript

'use client'
import Loading from '@/app/components/base/loading'
import { useWebAppStore } from '@/context/web-app-context'
import React, { useEffect, useState } from 'react'
const AuthenticatedLayout = ({ children }: { children: React.ReactNode }) => {
const shareCode = useWebAppStore(s => s.shareCode)
const webAppAccessMode = useWebAppStore(s => s.webAppAccessMode)
const [isLoading, setIsLoading] = useState(true)
useEffect(() => {
(async () => {
try {
setIsLoading(true)
}
catch (error) { console.error(error) }
finally {
setIsLoading(false)
}
})()
}, [webAppAccessMode, shareCode])
if (isLoading) {
return <div className='flex h-full items-center justify-center'>
<Loading />
</div>
}
return <>{children}</>
}
export default React.memo(AuthenticatedLayout)