chore(webui): refresh when creating/deleting a clan in-game (#2864)
So the clan tab shows/hides instantly as expected. Reviewed-on: #2864 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:
parent
0f7a85db59
commit
30f380f37e
@ -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);
|
||||||
@ -47,6 +48,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 {
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user