Browse Source

ensure error message shows, and unset register flag if there's an API error

starred-projects
Trent Larson 8 months ago
parent
commit
1be899c48d
  1. 1
      project.task.yaml
  2. 24
      src/views/AccountViewView.vue
  3. 3
      src/views/HomeView.vue
  4. 2
      src/views/NewEditProjectView.vue

1
project.task.yaml

@ -9,7 +9,6 @@ tasks:
- add button to front page to prompt for ideas for gratitude - add button to front page to prompt for ideas for gratitude
- show previous on "Your" screen - show previous on "Your" screen
- checkboxes: randomize vs show in order, show non-person-oriented messages, show only contacts, show only projects - 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 - 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 - allow user to add a time when they want their daily notification
- prompt for the name directly when they visit the QR scan page - prompt for the name directly when they visit the QR scan page

24
src/views/AccountViewView.vue

@ -1016,6 +1016,17 @@ export default class AccountViewView extends Vue {
} }
} catch (error) { } catch (error) {
this.handleRateLimitsError(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; this.loadingLimits = false;
@ -1044,17 +1055,12 @@ export default class AccountViewView extends Vue {
this.limitsMessage = this.limitsMessage =
(data?.error?.message as string) || "Bad server response."; (data?.error?.message as string) || "Bad server response.";
console.error( console.error(
"Got bad response retrieving limits, which usually means user isn't registered. Server says:", "Got bad response retrieving limits, which usually means user isn't registered:",
this.limitsMessage, error,
); );
} else if (
error instanceof Error &&
error.message ===
"Attempted to load Give records with no identifier available."
) {
this.limitsMessage = "You have no identifier.";
} else { } else {
// Handle other unknown errors this.limitsMessage = "Got an error retrieving limits.";
console.error("Got some error retrieving limits:", error);
} }
} }

3
src/views/HomeView.vue

@ -90,10 +90,11 @@
giving. giving.
<router-link <router-link
:to="{ name: 'contact-qr' }" :to="{ name: 'contact-qr' }"
class="block text-center text-md font-bold uppercase bg-blue-500 text-white mt-2 mb-4 px-2 py-3 rounded-md" class="block text-center text-md font-bold uppercase bg-blue-500 text-white mt-2 px-2 py-3 rounded-md"
> >
Show Them Your Identifier Info</router-link Show Them Your Identifier Info</router-link
> >
<br />
To double-check that you're registered, To double-check that you're registered,
<br /> <br />
<router-link :to="{ name: 'account' }" class="text-blue-500"> <router-link :to="{ name: 'account' }" class="text-blue-500">

2
src/views/NewEditProjectView.vue

@ -343,7 +343,7 @@ export default class NewEditProjectView extends Vue {
if (Object.prototype.hasOwnProperty.call(serverError, "message")) { if (Object.prototype.hasOwnProperty.call(serverError, "message")) {
userMessage = userMessage =
(serverError.response?.data?.error?.message as string) || (serverError.response?.data?.error?.message as string) ||
userMessage; // This is info for the user. userMessage;
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",

Loading…
Cancel
Save