From e88a5db3bfa844041202e5cabd910bee50757378 Mon Sep 17 00:00:00 2001 From: Robert Paciorek Date: Wed, 13 Sep 2023 08:42:36 +0000 Subject: [PATCH] more friendly response for profile not found --- src/Controllers/Common/ProfileController.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Controllers/Common/ProfileController.cs b/src/Controllers/Common/ProfileController.cs index 61efa0d..98b3628 100644 --- a/src/Controllers/Common/ProfileController.cs +++ b/src/Controllers/Common/ProfileController.cs @@ -23,8 +23,11 @@ public class ProfileController : Controller { // NOTE: this is public info (for mmo) - no session check Viking? viking = ctx.Vikings.FirstOrDefault(e => e.Id == userId); - if (viking is null) - return Conflict("Viking not found"); + if (viking is null) { + return Ok(new UserProfileData()); + // NOTE: do not return `Conflict("Viking not found")` due to client side error handling + // (not Ok response cause soft-lock client - can't close error message) + } return Ok(GetProfileDataFromViking(viking)); }