|
|
@ -1,10 +1,12 @@
|
|
|
|
import { Outlet, Link, useHref, useLocation, NavLink } from "react-router-dom";
|
|
|
|
import { Outlet, Link, useHref, useNavigate, NavLink } from "react-router-dom";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
import { observer } from "mobx-react";
|
|
|
|
import { observer } from "mobx-react";
|
|
|
|
|
|
|
|
import { toJS } from "mobx";
|
|
|
|
import { Layout, Menu, ConfigProvider, theme, Dropdown, Space, Row, Col, Badge, Typography, Divider, App as AntApp } from "antd";
|
|
|
|
import { Layout, Menu, ConfigProvider, theme, Dropdown, Space, Row, Col, Badge, Typography, Divider, App as AntApp } from "antd";
|
|
|
|
import { DownOutlined } from "@ant-design/icons";
|
|
|
|
import { DownOutlined } from "@ant-design/icons";
|
|
|
|
import "antd/dist/reset.css";
|
|
|
|
import "antd/dist/reset.css";
|
|
|
|
import AppLogo from "@/assets/logo-gh.png";
|
|
|
|
import AppLogo from "@/assets/logo-gh.png";
|
|
|
|
|
|
|
|
import { isEmpty } from "@/utils/commons";
|
|
|
|
import { useStore } from "@/stores/StoreContext.js";
|
|
|
|
import { useStore } from "@/stores/StoreContext.js";
|
|
|
|
|
|
|
|
|
|
|
|
const { Header, Content, Footer } = Layout;
|
|
|
|
const { Header, Content, Footer } = Layout;
|
|
|
@ -27,13 +29,20 @@ const items = [
|
|
|
|
key: "3",
|
|
|
|
key: "3",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
function App() {
|
|
|
|
function App() {
|
|
|
|
const { authStore, noticeStore } = useStore();
|
|
|
|
const { authStore, noticeStore } = useStore();
|
|
|
|
|
|
|
|
const { login } = authStore;
|
|
|
|
const { noticeUnRead } = noticeStore;
|
|
|
|
const { noticeUnRead } = noticeStore;
|
|
|
|
const href = useHref();
|
|
|
|
const href = useHref();
|
|
|
|
|
|
|
|
const loginToken = toJS(login).token;
|
|
|
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
// Check location
|
|
|
|
// Check location
|
|
|
|
console.info("href: " + href);
|
|
|
|
console.info("href: " + href + '; login.token: ' + loginToken);
|
|
|
|
|
|
|
|
if (href !== '/login' && isEmpty(loginToken)) {
|
|
|
|
|
|
|
|
// navigate('/login');
|
|
|
|
|
|
|
|
}
|
|
|
|
}, [href]);
|
|
|
|
}, [href]);
|
|
|
|
|
|
|
|
|
|
|
|
const splitPath = href.split("/");
|
|
|
|
const splitPath = href.split("/");
|
|
|
|