/** @format */

import { useNavigate } from "react-router-dom";
import { Button, Result } from "antd";
import { getStorageFromKey } from "@/utils/localStorage/config.ts";

export default () => {
	const navigate = useNavigate();
	const goBack = () => {
		const token = getStorageFromKey("token");
		if (token !== null && token !== undefined) {
			navigate("/main/home");
		} else {
			navigate("/");
		}
	};

	return (
		<>
			<Result
				status="404"
				title="404"
				subTitle="抱歉，访问的页面不存在！"
				extra={
					<Button type="primary" onClick={goBack}>
						返 回
					</Button>
				}
			/>
		</>
	);
};
