Push local state...

This commit is contained in:
TheArcaneBrony
2022-08-12 01:46:42 +02:00
parent 34ca1a8a6c
commit 44859db499
29 changed files with 2865 additions and 13818 deletions

View File

@@ -30,6 +30,7 @@ export interface RegisterSchema {
date_of_birth?: Date; // "2000-04-03"
gift_code_sku_id?: string;
captcha_key?: string;
promotional_email_opt_in?: boolean;
}
router.post("/", route({ body: "RegisterSchema" }), async (req: Request, res: Response) => {

View File

@@ -21,6 +21,7 @@ export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels" |
afk_timeout?: number;
afk_channel_id?: string;
preferred_locale?: string;
premium_progress_bar_enabled?: boolean;
}
router.get("/", route({}), async (req: Request, res: Response) => {

View File

@@ -10,8 +10,8 @@ router.patch("/", route({ body: "UserSettingsSchema" }), async (req: Request, re
const body = req.body as UserSettings;
if (body.locale === "en") body.locale = "en-US"; // fix discord client crash on unkown locale
const user = await User.findOneOrFail({ where: { id: req.user_id, bot: false } });
user.settings = { ...user.settings, ...body };
const user = await User.findOneOrFail({ where: { id: req.user_id, bot: false }, relations: ["settings"] });
user.settings = { ...user.settings, ...body } as UserSettings;
await user.save();
res.sendStatus(204);