|
|
@ -284,6 +284,7 @@ export default class HomeView extends Vue { |
|
|
|
this.allContacts = await db.contacts.toArray(); |
|
|
|
this.feedLastViewedId = settings?.lastViewedClaimId; |
|
|
|
this.updateAllFeed(); |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
} catch (err: any) { |
|
|
|
this.$notify( |
|
|
|
{ |
|
|
@ -384,12 +385,11 @@ export default class HomeView extends Vue { |
|
|
|
} |
|
|
|
|
|
|
|
giveDescription(giveRecord: GiveServerRecord) { |
|
|
|
let claim = giveRecord.fullClaim; |
|
|
|
if ((claim as any).claim) { |
|
|
|
// can happen for some claims wrapped in a Verifiable Credential |
|
|
|
claim = (claim as any).claim; |
|
|
|
} |
|
|
|
// claim.claim happen for some claims wrapped in a Verifiable Credential |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
const claim = (giveRecord.fullClaim as any).claim || giveRecord.fullClaim; |
|
|
|
// agent.did is for legacy data, before March 2023 |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
const giverDid = claim.agent?.identifier || (claim.agent as any)?.did; |
|
|
|
const giverInfo = didInfo( |
|
|
|
giverDid, |
|
|
@ -402,6 +402,7 @@ export default class HomeView extends Vue { |
|
|
|
: claim.description || "something unknown"; |
|
|
|
// recipient.did is for legacy data, before March 2023 |
|
|
|
const gaveRecipientId = |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
claim.recipient?.identifier || (claim.recipient as any)?.did; |
|
|
|
const gaveRecipientInfo = gaveRecipientId |
|
|
|
? " to " + |
|
|
@ -515,16 +516,19 @@ export default class HomeView extends Vue { |
|
|
|
-1, |
|
|
|
); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
} catch (error: any) { |
|
|
|
console.log("Error with give caught:", error); |
|
|
|
const message = |
|
|
|
error.userMessage || |
|
|
|
error.response?.data?.error?.message || |
|
|
|
"There was an error recording the give."; |
|
|
|
this.$notify( |
|
|
|
{ |
|
|
|
group: "alert", |
|
|
|
type: "danger", |
|
|
|
title: "Error", |
|
|
|
text: |
|
|
|
this.getGiveErrorMessage(error) || |
|
|
|
"There was an error recording the give.", |
|
|
|
text: message, |
|
|
|
}, |
|
|
|
-1, |
|
|
|
); |
|
|
@ -533,16 +537,14 @@ export default class HomeView extends Vue { |
|
|
|
|
|
|
|
// Helper functions for readability |
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
isGiveCreationError(result: any) { |
|
|
|
return result.status !== 201 || result.data?.error; |
|
|
|
} |
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
getGiveCreationErrorMessage(result: any) { |
|
|
|
return result.data?.error?.message; |
|
|
|
} |
|
|
|
|
|
|
|
getGiveErrorMessage(error: any) { |
|
|
|
return error.userMessage || error.response?.data?.error?.message; |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|