mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
optimize world state api call
This commit is contained in:
@@ -30,10 +30,11 @@ api.getWorldState = {
|
|||||||
const worldState = {};
|
const worldState = {};
|
||||||
|
|
||||||
worldState.worldBoss = await getWorldBoss();
|
worldState.worldBoss = await getWorldBoss();
|
||||||
worldState.currentEvent = getCurrentEvent();
|
|
||||||
worldState.npcImageSuffix = worldState.currentEvent ? worldState.currentEvent.npcImageSuffix : '';
|
|
||||||
|
|
||||||
worldState.currentEventList = getCurrentEventList();
|
worldState.currentEventList = getCurrentEventList();
|
||||||
|
if (worldState.currentEventList.length > 0) {
|
||||||
|
[worldState.currentEvent] = worldState.currentEventList;
|
||||||
|
worldState.npcImageSuffix = worldState.currentEvent ? worldState.currentEvent.npcImageSuffix : '';
|
||||||
|
}
|
||||||
|
|
||||||
res.respond(200, worldState);
|
res.respond(200, worldState);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user