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 :
- 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 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) {
if (error instanceof AxiosError) {
const data = error.response?.data as ErrorResponse;
this.limitsMessage = data?.error?.message || "Bad server response.";
console.error("Bad response retrieving limits:", error);
this.limitsMessage =
(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 (
error instanceof Error &&
error.message ===

101
src/views/ContactsView.vue

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

Loading…
Cancel
Save