bla
This commit is contained in:
parent
f933456c22
commit
b5bf2a347b
1 changed files with 15 additions and 8 deletions
23
index.js
23
index.js
|
@ -141,15 +141,22 @@ fastify.post('/switchState', async (request, reply) => {
|
|||
let content = request.body;
|
||||
let auth = checkAuthetification(content);
|
||||
if (auth.success) {
|
||||
if (ServiceState.state == "closed") {
|
||||
ServiceState.state = "open";
|
||||
if (AdminUsersUid.includes(content.uid)) {
|
||||
if (ServiceState.state == "closed") {
|
||||
ServiceState.state = "open";
|
||||
} else {
|
||||
ServiceState.state = "closed";
|
||||
}
|
||||
saveData(servicePath, ServiceState);
|
||||
return {
|
||||
success: true,
|
||||
state: ServiceState.state
|
||||
}
|
||||
} else {
|
||||
ServiceState.state = "closed";
|
||||
}
|
||||
saveData(servicePath, ServiceState);
|
||||
return {
|
||||
success: true,
|
||||
state: ServiceState.state
|
||||
return {
|
||||
success: false,
|
||||
why: "Not allowed"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return auth
|
||||
|
|
Loading…
Reference in a new issue