From 8d748a2cd069bbe1a12ba66b5e0b74d31559d8b9 Mon Sep 17 00:00:00 2001 From: weskubo-cgi <80127167+weskubo-cgi@users.noreply.github.com> Date: Wed, 25 Oct 2023 09:47:20 -0700 Subject: [PATCH] Fixed response handling for missing/no permission profiles. (#24) Co-authored-by: weskubo-cgi --- backend/src/components/user.js | 9 +++- frontend/src/App.vue | 85 +--------------------------------- 2 files changed, 8 insertions(+), 86 deletions(-) diff --git a/backend/src/components/user.js b/backend/src/components/user.js index d1fee51a..9ab9bd5c 100644 --- a/backend/src/components/user.js +++ b/backend/src/components/user.js @@ -11,6 +11,10 @@ const { UserProfileMappings, UserProfileOrganizationMappings, UserProfileFacilit const { MappableObjectForFront } = require('../util/mapping/MappableObject') const _ = require('lodash') +const USER_NOT_FOUND = 'User not found.' +const NO_PERMISSIONS = 'No permissions.' +const NO_PROFILE_FOUND = 'No profile found.' + async function getUserInfo(req, res) { const userInfo = getSessionUser(req) if (!userInfo || !userInfo.jwt || !userInfo._json) { @@ -133,8 +137,9 @@ async function getUserProfile(userGuid, userName) { return response.data } catch (e) { if (e.response?.status == '404') { - log.verbose('response ', e.response.data) - if (e.response?.data?.startsWith('User not found')) { + const data = e.response?.data + log.verbose('response ', data) + if (data?.startsWith(USER_NOT_FOUND) || data?.startsWith(NO_PERMISSIONS) || data?.startsWith(NO_PROFILE_FOUND)) { return null } return {} diff --git a/frontend/src/App.vue b/frontend/src/App.vue index e51d6747..c8ff324b 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -10,7 +10,7 @@ - + @@ -141,87 +141,4 @@ export default { width: 100%; z-index: 1002; } - -#toTopBtn { - opacity: 0.5; -} - -#toTopBtn:hover { - opacity: 1; -} -.v-alert.bootstrap-success { - color: #234720 !important; - background-color: #d9e7d8 !important; - border-color: #accbaa !important; -} - -.v-alert.bootstrap-info { - color: #4e6478; - background-color: #eaf2fa !important; - border-color: #b8d4ee !important; -} - -.v-alert.bootstrap-warning { - color: #81692c; - background-color: #fef4dd !important; - border-color: #fbdb8b !important; -} - -.v-alert.bootstrap-error { - color: #712024; - background-color: #f7d8da !important; - border-color: #eeaaad !important; -} - -.v-alert .v-icon { - padding-left: 0; -} - -.full-height { - height: 100%; -} - -.theme--light.application { - background: #f1f1f1; -} - -.v-toolbar__title { - font-size: 1rem; -} - -.v-btn { - text-transform: none !important; -} - -.v-alert .v-icon { - padding-left: 0; -} - -.v-alert.bootstrap-success { - color: #234720; - background-color: #d9e7d8 !important; - border-color: #accbaa !important; -} - -.v-alert.bootstrap-info { - color: #4e6478; - background-color: #eaf2fa !important; - border-color: #b8d4ee !important; -} - -.v-alert.bootstrap-warning { - color: #81692c; - background-color: #fef4dd !important; - border-color: #fbdb8b !important; -} - -.v-alert.bootstrap-error { - color: #712024; - background-color: #f7d8da !important; - border-color: #eeaaad !important; -} - -.theme--light.v-btn.v-btn--disabled:not(.v-btn--text):not(.v-btn--outlined) { - background-color: rgba(0, 0, 0, 0.12) !important; -}