Browse Source

tweak notifications on errors and other responses

more-smalls
Trent Larson 1 year ago
parent
commit
f43ecc98aa
  1. 1
      project.task.yaml
  2. 9
      src/views/AccountViewView.vue
  3. 101
      src/views/ContactsView.vue

1
project.task.yaml

@ -6,7 +6,6 @@ tasks:
- 40 notifications : - 40 notifications :
- push, where we trigger a ServiceWorker(?) in the app to reach out and check for new data assignee:matthew - push, where we trigger a ServiceWorker(?) in the app to reach out and check for new data assignee:matthew
- 01 bug - we get a 404 when reloading the page anyplace except "/", and it's hard to get back
- .1 test - make sure that a registration failure (including network failure) doesn't give a success message (which may have happened during board meeting) - .1 test - make sure that a registration failure (including network failure) doesn't give a success message (which may have happened during board meeting)
- .1 don't allow to even see the claim actions if they're not registered - .1 don't allow to even see the claim actions if they're not registered

9
src/views/AccountViewView.vue

@ -729,8 +729,13 @@ export default class AccountViewView extends Vue {
private handleRateLimitsError(error: unknown) { private handleRateLimitsError(error: unknown) {
if (error instanceof AxiosError) { if (error instanceof AxiosError) {
const data = error.response?.data as ErrorResponse; const data = error.response?.data as ErrorResponse;
this.limitsMessage = data?.error?.message || "Bad server response."; this.limitsMessage =
console.error("Bad response retrieving limits:", error); (data?.error?.message as string) || "Bad server response.";
console.log(
"Got bad response retrieving limits, which usually means user isn't registered. Server says:",
this.limitsMessage,
//error,
);
} else if ( } else if (
error instanceof Error && error instanceof Error &&
error.message === error.message ===

101
src/views/ContactsView.vue

@ -394,7 +394,7 @@ export default class ContactsView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error With Server", title: "Server Error",
text: text:
"Got an error retrieving your " + "Got an error retrieving your " +
(useRecipient ? "given" : "received") + (useRecipient ? "given" : "received") +
@ -453,7 +453,7 @@ export default class ContactsView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error With Server", title: "Server Error",
text: error as string, text: error as string,
}, },
-1, -1,
@ -589,6 +589,16 @@ export default class ContactsView extends Vue {
"?", "?",
) )
) { ) {
this.$notify(
{
group: "alert",
type: "toast",
text: "",
title: "Registration submitted...",
},
1000,
);
const identity = await this.getIdentity(this.activeDid); const identity = await this.getIdentity(this.activeDid);
const vcClaim: RegisterVerifiableCredential = { const vcClaim: RegisterVerifiableCredential = {
@ -671,7 +681,7 @@ export default class ContactsView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error With Server", title: "Server Error",
text: userMessage, text: userMessage,
}, },
-1, -1,
@ -696,36 +706,30 @@ export default class ContactsView extends Vue {
contact.seesMe = visibility; contact.seesMe = visibility;
db.contacts.update(contact.did, { seesMe: visibility }); db.contacts.update(contact.did, { seesMe: visibility });
} else { } else {
console.error("Bad response setting visibility: ", resp.data); console.error(
if (resp.data.error?.message) { "Got some bad server response when setting visibility: ",
this.$notify( resp,
{ );
group: "alert", const message =
type: "danger", resp.data.error?.message || "Bad server response of " + resp.status;
title: "Error With Server", this.$notify(
text: resp.data.error?.message, {
}, group: "alert",
-1, type: "danger",
); title: "Server Error",
} else { text: message,
this.$notify( },
{ -1,
group: "alert", );
type: "danger",
title: "Error With Server",
text: "Bad server response of " + resp.status,
},
-1,
);
}
} }
} catch (err) { } catch (err) {
console.error("Got some server error when setting visibility:", err);
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error With Server", title: "Server Error",
text: err as string, text: "Check connectivity and try again.",
}, },
-1, -1,
); );
@ -750,7 +754,7 @@ export default class ContactsView extends Vue {
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
type: "toast", type: "info",
title: "Refreshed", title: "Refreshed",
text: text:
this.nameForContact(contact, true) + this.nameForContact(contact, true) +
@ -758,38 +762,29 @@ export default class ContactsView extends Vue {
(visibility ? "" : "not ") + (visibility ? "" : "not ") +
"see your activity.", "see your activity.",
}, },
5000, -1,
); );
} else { } else {
if (resp.data.error?.message) { const message =
this.$notify( resp.data.error?.message || "Bad server response of " + resp.status;
{ this.$notify(
group: "alert", {
type: "danger", group: "alert",
title: "Error With Server", type: "danger",
text: resp.data.error?.message, title: "Server Error",
}, text: resp.data.error?.message,
-1, },
); -1,
} else { );
this.$notify(
{
group: "alert",
type: "danger",
title: "Error With Server",
text: "Bad server response of " + resp.status,
},
-1,
);
}
} }
} catch (err) { } catch (err) {
console.log("Caught error from server request to check visibility:", err);
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error With Server", title: "Server Error",
text: err as string, text: "Check connectivity and try again.",
}, },
-1, -1,
); );
@ -989,7 +984,7 @@ export default class ContactsView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error With Server", title: "Server Error",
text: userMessage, text: userMessage,
}, },
-1, -1,

Loading…
Cancel
Save