chore(webui): update inventory when login reward was claimed (#2367)
All checks were successful
Build / build (push) Successful in 48s
Build Docker image / docker-arm64 (push) Successful in 1m1s
Build Docker image / docker-amd64 (push) Successful in 1m11s

Closes #2360

Reviewed-on: #2367
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-06-30 13:30:09 -07:00 committed by Sainan
parent 5e05a15743
commit 24d9dc27e2
2 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import {
} from "@/src/services/loginRewardService";
import { getInventory } from "@/src/services/inventoryService";
import { config } from "@/src/services/configService";
import { sendWsBroadcastTo } from "@/src/services/webService";
export const loginRewardsController: RequestHandler = async (req, res) => {
const account = await getAccountForRequest(req);
@ -51,6 +52,8 @@ export const loginRewardsController: RequestHandler = async (req, res) => {
setAccountGotLoginRewardToday(account);
await account.save();
sendWsBroadcastTo(account._id.toString(), { update_inventory: true });
}
res.json(response);
};

View File

@ -6,6 +6,7 @@ import {
} from "@/src/services/loginRewardService";
import { getAccountForRequest } from "@/src/services/loginService";
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
import { sendWsBroadcastTo } from "@/src/services/webService";
import { IInventoryChanges } from "@/src/types/purchaseTypes";
import { logger } from "@/src/utils/logger";
import { RequestHandler } from "express";
@ -39,6 +40,7 @@ export const loginRewardsSelectionController: RequestHandler = async (req, res)
setAccountGotLoginRewardToday(account);
await account.save();
sendWsBroadcastTo(account._id.toString(), { update_inventory: true });
res.json({
DailyTributeInfo: {
NewInventory: inventoryChanges,