Files
FastGPT/projects/app/src/pages/_error.tsx
2023-10-14 23:02:01 +08:00

43 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { useEffect } from 'react';
import { useRouter } from 'next/router';
import { serviceSideProps } from '@/web/common/utils/i18n';
import { useGlobalStore } from '@/web/common/store/global';
function Error() {
const router = useRouter();
const { lastRoute } = useGlobalStore();
useEffect(() => {
setTimeout(() => {
window.umami?.track('pageError', {
userAgent: navigator.userAgent,
platform: navigator.platform,
appName: navigator.appName,
lastRoute,
route: router.asPath
});
}, 1000);
setTimeout(() => {
router.back();
}, 2000);
}, []);
return (
<p>
safari chrome
</p>
);
}
export async function getServerSideProps(context: any) {
console.log('[render error]: ', context);
return {
props: { ...(await serviceSideProps(context)) }
};
}
export default Error;