mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Clear app context when navigating to home page.
This commit is contained in:
@@ -6,6 +6,7 @@ import { MdOutlinePerson, MdSearch, MdSettings } from "react-icons/md";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import UploadingSideBar from "./uploading_side_bar.tsx";
|
import UploadingSideBar from "./uploading_side_bar.tsx";
|
||||||
import { IoLogoGithub } from "react-icons/io";
|
import { IoLogoGithub } from "react-icons/io";
|
||||||
|
import {useAppContext} from "./AppContext.tsx";
|
||||||
|
|
||||||
export default function Navigator() {
|
export default function Navigator() {
|
||||||
const outlet = useOutlet()
|
const outlet = useOutlet()
|
||||||
@@ -14,6 +15,8 @@ export default function Navigator() {
|
|||||||
|
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
|
|
||||||
|
const appContext = useAppContext();
|
||||||
|
|
||||||
const [naviContext, _] = useState<NavigatorContext>({
|
const [naviContext, _] = useState<NavigatorContext>({
|
||||||
refresh: () => {
|
refresh: () => {
|
||||||
setKey(key + 1);
|
setKey(key + 1);
|
||||||
@@ -25,6 +28,7 @@ export default function Navigator() {
|
|||||||
<div className={"flex-1 max-w-7xl mx-auto flex"}>
|
<div className={"flex-1 max-w-7xl mx-auto flex"}>
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<button className="btn btn-ghost text-xl" onClick={() => {
|
<button className="btn btn-ghost text-xl" onClick={() => {
|
||||||
|
appContext.clear()
|
||||||
navigate(`/`);
|
navigate(`/`);
|
||||||
}}>{app.appName}</button>
|
}}>{app.appName}</button>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user