This commit is contained in:
asyncnomi 2023-01-10 09:25:06 +01:00
parent f933456c22
commit b5bf2a347b

View file

@ -141,15 +141,22 @@ fastify.post('/switchState', async (request, reply) => {
let content = request.body; let content = request.body;
let auth = checkAuthetification(content); let auth = checkAuthetification(content);
if (auth.success) { if (auth.success) {
if (ServiceState.state == "closed") { if (AdminUsersUid.includes(content.uid)) {
ServiceState.state = "open"; if (ServiceState.state == "closed") {
ServiceState.state = "open";
} else {
ServiceState.state = "closed";
}
saveData(servicePath, ServiceState);
return {
success: true,
state: ServiceState.state
}
} else { } else {
ServiceState.state = "closed"; return {
} success: false,
saveData(servicePath, ServiceState); why: "Not allowed"
return { }
success: true,
state: ServiceState.state
} }
} else { } else {
return auth return auth