[~] Fix : added server state update at /serverStop

Signed-off-by: Charles Le Maux <charles.le-maux@epitech.eu>
This commit is contained in:
Charles Le Maux 2024-06-30 00:46:52 +01:00
parent 156d95c1cb
commit 6b9df8e668
2 changed files with 2 additions and 1 deletions

View File

@ -100,7 +100,7 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
function sendRequest(endpoint, payload) { function sendRequest(endpoint, payload) {
return fetch(`https://176.165.62.226:3000/${endpoint}`, { return fetch(`http://176.165.62.226:3000/${endpoint}`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

View File

@ -155,6 +155,7 @@ def server_stop(user: UserRecord, name: str) -> tuple[HTTPStatus, str or None]:
return HTTPStatus.NOT_FOUND, f"Server {name} not found in firestore." return HTTPStatus.NOT_FOUND, f"Server {name} not found in firestore."
exists: bool = mc_manager.stop_server(port) exists: bool = mc_manager.stop_server(port)
if exists: if exists:
firebase_manager.update_server_running_state(user.uid, name, False)
return HTTPStatus.OK, f"Successfully stopped server {name}." return HTTPStatus.OK, f"Successfully stopped server {name}."
return HTTPStatus.OK, f"Server {name} already stopped." return HTTPStatus.OK, f"Server {name} already stopped."
except Exception as e: except Exception as e: