bla
This commit is contained in:
parent
f933456c22
commit
b5bf2a347b
23
index.js
23
index.js
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue