This commit is contained in:
Killer Boss Original 2022-07-05 16:27:01 +02:00 committed by GitHub
parent 1e6a48e5dc
commit 15b4687537
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,9 +82,10 @@ async function searchElement(request, response) {
authenticate(token, response, search) authenticate(token, response, search)
var elements = await db.get(word) var elements = await db.get(word)
var elements = JSON.parse(elements);
if(elements) { if(elements) {
var reply = {elements}; var reply = elements
} else { } else {
var reply = { var reply = {
status:"Not Found" status:"Not Found"
@ -108,8 +109,9 @@ async function set(request, response) {
await db.set(element, data) await db.set(element, data)
const res = await db.get(element) const res = await db.get(element)
var res = JSON.parse(res);
if(res) { if(res) {
var reply = {res}; var reply = res;
} else { } else {
var reply = { var reply = {
status:"404-Not Found" status:"404-Not Found"
@ -133,10 +135,9 @@ async function remove(request, response) {
await db.set(element, data) await db.set(element, data)
const res = await db.delete(element) const res = await db.delete(element)
var res = JSON.parse(res);
if(res) { if(res) {
var reply = { var reply = res
res
};
} else { } else {
var reply = { var reply = {
status:"Not Found" status:"Not Found"