From 1be899c48d68bdad061b0de3d1c8adcd35e6ea2a Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 2 Feb 2024 17:40:06 -0700 Subject: [PATCH] ensure error message shows, and unset register flag if there's an API error --- project.task.yaml | 1 - src/views/AccountViewView.vue | 24 +++++++++++++++--------- src/views/HomeView.vue | 3 ++- src/views/NewEditProjectView.vue | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index 5981aa8..81e4bd4 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -9,7 +9,6 @@ tasks: - add button to front page to prompt for ideas for gratitude - show previous on "Your" screen - checkboxes: randomize vs show in order, show non-person-oriented messages, show only contacts, show only projects - - remove the "backward" button when in the middle of the contact-browsing part (since they can't go back or forward) - bug - on fulfilling an offer, it shows "Someone not in Contacts" and not "you" for your own delivery - allow user to add a time when they want their daily notification - prompt for the name directly when they visit the QR scan page diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index b614acf..47633a5 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -1016,6 +1016,17 @@ export default class AccountViewView extends Vue { } } catch (error) { this.handleRateLimitsError(error); + + try { + await db.open(); + db.settings.update(MASTER_SETTINGS_KEY, { + isRegistered: false, + }); + this.isRegistered = false; + } catch (err) { + console.error("Got an error marking user not registered:", err); + // already set an error notification for the user + } } this.loadingLimits = false; @@ -1044,17 +1055,12 @@ export default class AccountViewView extends Vue { this.limitsMessage = (data?.error?.message as string) || "Bad server response."; console.error( - "Got bad response retrieving limits, which usually means user isn't registered. Server says:", - this.limitsMessage, + "Got bad response retrieving limits, which usually means user isn't registered:", + error, ); - } else if ( - error instanceof Error && - error.message === - "Attempted to load Give records with no identifier available." - ) { - this.limitsMessage = "You have no identifier."; } else { - // Handle other unknown errors + this.limitsMessage = "Got an error retrieving limits."; + console.error("Got some error retrieving limits:", error); } } diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 23b66ce..5f46dba 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -90,10 +90,11 @@ giving. Show Them Your Identifier Info +
To double-check that you're registered,
diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index 62a204d..890fd56 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -343,7 +343,7 @@ export default class NewEditProjectView extends Vue { if (Object.prototype.hasOwnProperty.call(serverError, "message")) { userMessage = (serverError.response?.data?.error?.message as string) || - userMessage; // This is info for the user. + userMessage; this.$notify( { group: "alert",