From fba0f4703a2dd0508281d978f05ff0411fdfe8b3 Mon Sep 17 00:00:00 2001 From: Kaeno Date: Sun, 7 Jul 2024 13:07:36 +0000 Subject: [PATCH] Setup route to allow switching of profile icon. (!369) Reviewed-on: https://dev.sp-tarkov.com/SPT/Server/pulls/369 --- project/src/callbacks/ProfileCallbacks.ts | 6 +++--- project/src/controllers/ProfileController.ts | 5 +++-- project/src/routers/static/ProfileStaticRouter.ts | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/project/src/callbacks/ProfileCallbacks.ts b/project/src/callbacks/ProfileCallbacks.ts index bb021f34..4ac7f83b 100644 --- a/project/src/callbacks/ProfileCallbacks.ts +++ b/project/src/callbacks/ProfileCallbacks.ts @@ -167,10 +167,10 @@ export class ProfileCallbacks url: string, info: IGetProfileSettingsRequest, sessionId: string, - ): IGetBodyResponseData + ): IGetBodyResponseData { - this.profileController.setChosenProfileIcon(sessionId, info); - return this.httpResponse.emptyResponse(); + + return this.httpResponse.getBody(this.profileController.setChosenProfileIcon(sessionId, info)); } /** diff --git a/project/src/controllers/ProfileController.ts b/project/src/controllers/ProfileController.ts index b21c470b..f6121190 100644 --- a/project/src/controllers/ProfileController.ts +++ b/project/src/controllers/ProfileController.ts @@ -489,14 +489,15 @@ export class ProfileController /** * Handle client/profile/settings */ - public setChosenProfileIcon(sessionId: string, request: IGetProfileSettingsRequest): void + public setChosenProfileIcon(sessionId: string, request: IGetProfileSettingsRequest): boolean { const profileToUpdate = this.profileHelper.getPmcProfile(sessionId); if (!profileToUpdate) { - return; + return false; } profileToUpdate.Info.SelectedMemberCategory = request.memberCategory; + return true; } } diff --git a/project/src/routers/static/ProfileStaticRouter.ts b/project/src/routers/static/ProfileStaticRouter.ts index 7b17ba00..a4f25b50 100644 --- a/project/src/routers/static/ProfileStaticRouter.ts +++ b/project/src/routers/static/ProfileStaticRouter.ts @@ -126,7 +126,7 @@ export class ProfileStaticRouter extends StaticRouter info: any, sessionID: string, output: string, - ): Promise> => + ): Promise> => { return this.profileCallbacks.getProfileSettings(url, info, sessionID); },