kuma-archive/src/components/dashboard/index.tsx
2025-03-13 16:06:35 +09:00

31 lines
705 B
TypeScript

import { useEffect, useState } from "react";
import Directory from "../directory";
import { usePath } from "../../store/path";
import { useLocation } from "react-router";
import "./dashboard.scss";
function Dashboard() {
const path = usePath();
const location = useLocation();
const [load, setLoad] = useState(false);
useEffect(() => {
if (!load) {
path.update(location.pathname.substring(1, location.pathname.length));
setLoad(true);
}
const id = setInterval(() => {
path.update(location.pathname.substring(1, location.pathname.length));
}, 5000);
return () => clearInterval(id);
}, [load, path, location]);
return (
<Directory />
);
}
export default Dashboard;