Restrict access to advanced settings page
This commit is contained in:
1 parent
43a56e1de1
commit
b8984c0160
2 files changed
+6
-2
No files matched your search
@@ -10,14 +10,17 @@ import LoadingButton from "@mui/lab/LoadingButton";
|
|||||||
import { ConfigBox } from "../Settings/styled";
|
import { ConfigBox } from "../Settings/styled";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { updateAppSettings } from "../../Features/Settings/settingsSlice";
|
import { updateAppSettings } from "../../Features/Settings/settingsSlice";
|
||||||
import { useState } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import Select from "../../Components/Inputs/Select";
|
import Select from "../../Components/Inputs/Select";
|
||||||
|
|
||||||
const AdvancedSettings = ({ isAdmin }) => {
|
const AdvancedSettings = ({ isAdmin }) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
navigate("/");
|
navigate("/");
|
||||||
}
|
}
|
||||||
|
}, [navigate, isAdmin]);
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { authToken } = useSelector((state) => state.auth);
|
const { authToken } = useSelector((state) => state.auth);
|
||||||
@@ -75,7 +78,6 @@ const AdvancedSettings = ({ isAdmin }) => {
|
|||||||
noValidate
|
noValidate
|
||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
>
|
>
|
||||||
\{" "}
|
|
||||||
<ConfigBox>
|
<ConfigBox>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h1">Client Settings</Typography>
|
<Typography component="h1">Client Settings</Typography>
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ const Settings = ({ isAdmin }) => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</ConfigBox>
|
</ConfigBox>
|
||||||
)}
|
)}
|
||||||
|
{isAdmin && (
|
||||||
<ConfigBox>
|
<ConfigBox>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h1">Advanced Settings</Typography>
|
<Typography component="h1">Advanced Settings</Typography>
|
||||||
@@ -271,6 +272,7 @@ const Settings = ({ isAdmin }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
</ConfigBox>
|
</ConfigBox>
|
||||||
|
)}
|
||||||
<ConfigBox>
|
<ConfigBox>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h1">About</Typography>
|
<Typography component="h1">About</Typography>
|
||||||
|
|||||||
Reference in new issue
Block a user