chore(webui): refresh when creating/deleting a clan in-game
All checks were successful
Build / build (pull_request) Successful in 3m4s

So the clan tab shows/hides instantly as expected.
This commit is contained in:
Sainan 2025-10-06 20:55:11 +02:00
parent 66d3057d40
commit eea3dcd2fd
2 changed files with 4 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import { Guild, GuildMember } from "../../models/guildModel.ts";
import { createUniqueClanName, getGuildClient, giveClanKey } from "../../services/guildService.ts"; import { createUniqueClanName, getGuildClient, giveClanKey } from "../../services/guildService.ts";
import { getInventory } from "../../services/inventoryService.ts"; import { getInventory } from "../../services/inventoryService.ts";
import type { IInventoryChanges } from "../../types/purchaseTypes.ts"; import type { IInventoryChanges } from "../../types/purchaseTypes.ts";
import { sendWsBroadcastTo } from "../../services/wsService.ts";
export const createGuildController: RequestHandler = async (req, res) => { export const createGuildController: RequestHandler = async (req, res) => {
const account = await getAccountForRequest(req); const account = await getAccountForRequest(req);
@ -37,6 +38,7 @@ export const createGuildController: RequestHandler = async (req, res) => {
...(await getGuildClient(guild, account)), ...(await getGuildClient(guild, account)),
InventoryChanges: inventoryChanges InventoryChanges: inventoryChanges
}); });
sendWsBroadcastTo(account._id.toString(), { update_inventory: true });
}; };
interface ICreateGuildRequest { interface ICreateGuildRequest {

View File

@ -10,6 +10,7 @@ import {
import { createMessage } from "../../services/inboxService.ts"; import { createMessage } from "../../services/inboxService.ts";
import { getInventory } from "../../services/inventoryService.ts"; import { getInventory } from "../../services/inventoryService.ts";
import { getAccountForRequest, getSuffixedName } from "../../services/loginService.ts"; import { getAccountForRequest, getSuffixedName } from "../../services/loginService.ts";
import { sendWsBroadcastTo } from "../../services/wsService.ts";
import { GuildPermission } from "../../types/guildTypes.ts"; import { GuildPermission } from "../../types/guildTypes.ts";
import type { RequestHandler } from "express"; import type { RequestHandler } from "express";
@ -85,6 +86,7 @@ export const removeFromGuildController: RequestHandler = async (req, res) => {
ItemToRemove: "/Lotus/Types/Keys/DojoKey", ItemToRemove: "/Lotus/Types/Keys/DojoKey",
RecipeToRemove: "/Lotus/Types/Keys/DojoKeyBlueprint" RecipeToRemove: "/Lotus/Types/Keys/DojoKeyBlueprint"
}); });
sendWsBroadcastTo(payload.userId, { update_inventory: true });
}; };
interface IRemoveFromGuildRequest { interface IRemoveFromGuildRequest {