From ab2702a93efbd7a941bf2d24e12b772420a87c1b Mon Sep 17 00:00:00 2001 From: tfcprivt <141457761+privt00@users.noreply.github.com> Date: Mon, 15 Apr 2024 19:27:49 +0200 Subject: [PATCH] Update inbox.js --- api/user/inbox.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/user/inbox.js b/api/user/inbox.js index 7c22dca..d86149a 100644 --- a/api/user/inbox.js +++ b/api/user/inbox.js @@ -4,18 +4,17 @@ const express = require("express"); module.exports.load = async function (app, db) { app.get("/api/inbox", async (req, res) => { try { - if (!req.session.pterodactyl || !req.session.pterodactyl.username) { + if (!req.session.pterodactyl.username) { return res.status(401).json({ error: 'Unauthorized' }); } const userId = req.session.pterodactyl.username; - const allUserId = '@a'; + const alluserId = '@a'; const inboxData = JSON.parse(fs.readFileSync("./inbox.json", "utf8")); const userMessages = inboxData.messages.filter(message => message.toUserId === userId); - const allUserMessages = inboxData.messages.filter(message => message.toUserId === allUserId); - - res.json({ userMessages, allUserMessages }); + const userMessages1 = inboxData.messages.filter(message => message.toUserId === alluserId); + res.json({ messages: userMessages,messages: userMessages1 }); } catch (error) { console.error('Error loading inbox data:', error); res.status(500).json({ error: 'Internal Server Error' });