mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
optimize world state api call
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user