'use client' import { useGlobal } from '@/lib/global' import { isBrowser } from '@/lib/utils' import { useEffect } from 'react' import { useRouter } from 'next/router' /** * 404 頁面 */ const Layout404 = () => { const router = useRouter() const { locale } = useGlobal() useEffect(() => { // 延遲 3 秒若載入失敗就返回首頁 setTimeout(() => { const article = isBrowser && document.getElementById('article-wrapper') if (!article) { router.push('/').then(() => { // console.log('找不到頁面', router.asPath) }) } }, 3000) }, [router]) return ( <>

404

{locale.NAV.PAGE_NOT_FOUND_REDIRECT}

) } export { Layout404 }