mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-01-16 18:09:38 -06:00
The HeaderComponent.jsx now checks if the admin password is correct
This commit is contained in:
@@ -16,7 +16,7 @@ function HeaderComponent() {
|
||||
const [icon, setIcon] = useState(faGear);
|
||||
const [status, updateStatus] = useContext(StatusContext);
|
||||
const updateTests = useContext(SpeedtestContext)[1];
|
||||
const [config, reloadConfig] = useContext(ConfigContext);
|
||||
const [config, reloadConfig, checkConfig] = useContext(ConfigContext);
|
||||
const [updateAvailable, setUpdateAvailable] = useState("");
|
||||
|
||||
function switchDropdown() {
|
||||
@@ -32,6 +32,10 @@ function HeaderComponent() {
|
||||
onSuccess: (value) => {
|
||||
localStorage.setItem("password", value);
|
||||
reloadConfig();
|
||||
checkConfig().then((config) => config?.viewMode ? showPasswordDialog() : false).catch(() => showPasswordDialog());
|
||||
},
|
||||
onClose: () => {
|
||||
localStorage.removeItem("password");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user