From 7d62c87de31fca069ff7494340b6689b33d79265 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Mon, 6 May 2024 11:53:03 +0200 Subject: [PATCH] optimize world state api call --- website/server/controllers/api-v3/world.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/server/controllers/api-v3/world.js b/website/server/controllers/api-v3/world.js index eeb42d8c24..8355436f9e 100644 --- a/website/server/controllers/api-v3/world.js +++ b/website/server/controllers/api-v3/world.js @@ -30,10 +30,11 @@ api.getWorldState = { const worldState = {}; worldState.worldBoss = await getWorldBoss(); - worldState.currentEvent = getCurrentEvent(); - worldState.npcImageSuffix = worldState.currentEvent ? worldState.currentEvent.npcImageSuffix : ''; - worldState.currentEventList = getCurrentEventList(); + if (worldState.currentEventList.length > 0) { + [worldState.currentEvent] = worldState.currentEventList; + worldState.npcImageSuffix = worldState.currentEvent ? worldState.currentEvent.npcImageSuffix : ''; + } res.respond(200, worldState); },