|
@@ -1,15 +1,28 @@
|
|
|
-import { Layout } from "antd";
|
|
|
|
|
|
|
+import { Layout, Result } from "antd";
|
|
|
import { Outlet } from "react-router-dom";
|
|
import { Outlet } from "react-router-dom";
|
|
|
import LeftSider from "../../components/admin/LeftSider";
|
|
import LeftSider from "../../components/admin/LeftSider";
|
|
|
import HeadBar from "../../components/studio/HeadBar";
|
|
import HeadBar from "../../components/studio/HeadBar";
|
|
|
|
|
+import { useAppSelector } from "../../hooks";
|
|
|
|
|
+import { currentUser } from "../../reducers/current-user";
|
|
|
|
|
|
|
|
const Widget = () => {
|
|
const Widget = () => {
|
|
|
|
|
+ const user = useAppSelector(currentUser);
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
<HeadBar />
|
|
<HeadBar />
|
|
|
<Layout>
|
|
<Layout>
|
|
|
<LeftSider />
|
|
<LeftSider />
|
|
|
- <Outlet />
|
|
|
|
|
|
|
+ {user?.roles?.includes("root") ||
|
|
|
|
|
+ user?.roles?.includes("administrator") ? (
|
|
|
|
|
+ <Outlet />
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <Result
|
|
|
|
|
+ status="403"
|
|
|
|
|
+ title="403"
|
|
|
|
|
+ subTitle="Sorry, you are not authorized to access this page."
|
|
|
|
|
+ />
|
|
|
|
|
+ )}
|
|
|
</Layout>
|
|
</Layout>
|
|
|
</div>
|
|
</div>
|
|
|
);
|
|
);
|