mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2024-12-31 03:11:17 +02:00
small adjustments and bugfixes
This commit is contained in:
parent
774c40bfa5
commit
d6f7487bc8
@ -28,6 +28,7 @@ const App = () => {
|
||||
const handleAuthenticationStatus = async () => {
|
||||
const status = await user.status();
|
||||
setIsAuthenticated(status.success);
|
||||
await updateServerStatus();
|
||||
};
|
||||
|
||||
const handleLogout = async () => {
|
||||
|
@ -77,9 +77,9 @@ const Layout = ({children, handleLogout, serverStatus, updateServerStatus}) => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="py-4 px-2 accentuated">
|
||||
<h1 className="text-dirty-white text-lg mb-2 mx-4">Administration</h1>
|
||||
<h1 className="text-dirty-white text-lg mb-2 mx-4">FSM Administration</h1>
|
||||
<div className="text-white text-center rounded-sm bg-black shadow-inner mx-4 p-1">
|
||||
<Link to="/user-management">User Management</Link>
|
||||
<Link to="/user-management">Users</Link>
|
||||
<Link to="/help" last={true}>Help</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -11,21 +11,22 @@ const Login = ({handleLogin}) => {
|
||||
const location = useLocation()
|
||||
|
||||
const onSubmit = async data => {
|
||||
const status = await user.login(data)
|
||||
if (status.success) {
|
||||
handleLogin()
|
||||
history.push('/')
|
||||
const loginAttempt = await user.login(data)
|
||||
if (loginAttempt.success) {
|
||||
await handleLogin();
|
||||
history.push('/');
|
||||
}
|
||||
};
|
||||
|
||||
// on mount check if user is authenticated
|
||||
useEffect(() => {
|
||||
user.status().then(status => {
|
||||
(async () => {
|
||||
const status = await user.status()
|
||||
if (status.success) {
|
||||
handleLogin()
|
||||
await handleLogin();
|
||||
history.push(location?.state?.from || '/');
|
||||
}
|
||||
})
|
||||
})();
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
@ -10,7 +10,7 @@ export default {
|
||||
return response.data;
|
||||
},
|
||||
stop: async () => {
|
||||
const response = await client.post('/api/server/stop');
|
||||
const response = await client.get('/api/server/stop');
|
||||
return response.data;
|
||||
},
|
||||
start: async (ip, port, savefile) => {
|
||||
|
Loading…
Reference in New Issue
Block a user