forked from jsnbuchanan/crowd-funder-for-time-pwa
fix some incorrect logic & things AI hallucinated
This commit is contained in:
@@ -320,10 +320,7 @@ export default class GiftedDialog extends Vue {
|
|||||||
this.fromProjectId,
|
this.fromProjectId,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (!result.success || result.error) {
|
||||||
result.type === "error" ||
|
|
||||||
this.isGiveCreationError(result.response)
|
|
||||||
) {
|
|
||||||
const errorMessage = this.getGiveCreationErrorMessage(result);
|
const errorMessage = this.getGiveCreationErrorMessage(result);
|
||||||
logger.error("Error with give creation result:", result);
|
logger.error("Error with give creation result:", result);
|
||||||
this.$notify(
|
this.$notify(
|
||||||
@@ -370,15 +367,6 @@ export default class GiftedDialog extends Vue {
|
|||||||
|
|
||||||
// Helper functions for readability
|
// Helper functions for readability
|
||||||
|
|
||||||
/**
|
|
||||||
* @param result response "data" from the server
|
|
||||||
* @returns true if the result indicates an error
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
isGiveCreationError(result: any) {
|
|
||||||
return result.status !== 201 || result.data?.error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
|
* @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
|
||||||
* @returns best guess at an error message
|
* @returns best guess at an error message
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// similar to VerifiableCredentialSubject... maybe rename this
|
// similar to VerifiableCredentialSubject... maybe rename this
|
||||||
export interface GenericVerifiableCredential {
|
export interface GenericVerifiableCredential {
|
||||||
"@context": string | string[];
|
"@context"?: string;
|
||||||
"@type": string;
|
"@type": string;
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ export interface KeyMeta {
|
|||||||
|
|
||||||
export interface QuantitativeValue extends GenericVerifiableCredential {
|
export interface QuantitativeValue extends GenericVerifiableCredential {
|
||||||
"@type": "QuantitativeValue";
|
"@type": "QuantitativeValue";
|
||||||
"@context": string | string[];
|
"@context"?: string;
|
||||||
amountOfThisGood: number;
|
amountOfThisGood: number;
|
||||||
unitCode: string;
|
unitCode: string;
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
@@ -102,7 +102,7 @@ export interface Agent {
|
|||||||
|
|
||||||
export interface ClaimObject {
|
export interface ClaimObject {
|
||||||
"@type": string;
|
"@type": string;
|
||||||
"@context"?: string | string[];
|
"@context"?: string;
|
||||||
fulfills?: Array<{
|
fulfills?: Array<{
|
||||||
"@type": string;
|
"@type": string;
|
||||||
identifier?: string;
|
identifier?: string;
|
||||||
@@ -119,7 +119,7 @@ export interface ClaimObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface VerifiableCredentialClaim {
|
export interface VerifiableCredentialClaim {
|
||||||
"@context": string | string[];
|
"@context"?: string;
|
||||||
"@type": string;
|
"@type": string;
|
||||||
type: string[];
|
type: string[];
|
||||||
credentialSubject: ClaimObject;
|
credentialSubject: ClaimObject;
|
||||||
@@ -128,7 +128,6 @@ export interface VerifiableCredentialClaim {
|
|||||||
|
|
||||||
export interface GiveVerifiableCredential extends GenericVerifiableCredential {
|
export interface GiveVerifiableCredential extends GenericVerifiableCredential {
|
||||||
"@type": "GiveAction";
|
"@type": "GiveAction";
|
||||||
"@context": string | string[];
|
|
||||||
object?: GenericVerifiableCredential;
|
object?: GenericVerifiableCredential;
|
||||||
agent?: Agent;
|
agent?: Agent;
|
||||||
participant?: {
|
participant?: {
|
||||||
@@ -144,8 +143,7 @@ export interface GiveVerifiableCredential extends GenericVerifiableCredential {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface OfferVerifiableCredential extends GenericVerifiableCredential {
|
export interface OfferVerifiableCredential extends GenericVerifiableCredential {
|
||||||
"@type": "OfferAction";
|
"@type": "Offer";
|
||||||
"@context": string | string[];
|
|
||||||
object?: GenericVerifiableCredential;
|
object?: GenericVerifiableCredential;
|
||||||
agent?: Agent;
|
agent?: Agent;
|
||||||
participant?: {
|
participant?: {
|
||||||
@@ -167,7 +165,6 @@ export interface OfferVerifiableCredential extends GenericVerifiableCredential {
|
|||||||
export interface RegisterVerifiableCredential
|
export interface RegisterVerifiableCredential
|
||||||
extends GenericVerifiableCredential {
|
extends GenericVerifiableCredential {
|
||||||
"@type": "RegisterAction";
|
"@type": "RegisterAction";
|
||||||
"@context": string | string[];
|
|
||||||
agent: {
|
agent: {
|
||||||
identifier: string;
|
identifier: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -668,9 +668,6 @@ export function hydrateGive(
|
|||||||
: {
|
: {
|
||||||
"@context": SCHEMA_ORG_CONTEXT,
|
"@context": SCHEMA_ORG_CONTEXT,
|
||||||
"@type": "GiveAction",
|
"@type": "GiveAction",
|
||||||
object: undefined,
|
|
||||||
agent: undefined,
|
|
||||||
fulfills: [],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (lastClaimId) {
|
if (lastClaimId) {
|
||||||
@@ -688,8 +685,6 @@ export function hydrateGive(
|
|||||||
|
|
||||||
if (amount && !isNaN(amount)) {
|
if (amount && !isNaN(amount)) {
|
||||||
const quantitativeValue: QuantitativeValue = {
|
const quantitativeValue: QuantitativeValue = {
|
||||||
"@context": SCHEMA_ORG_CONTEXT,
|
|
||||||
"@type": "QuantitativeValue",
|
|
||||||
amountOfThisGood: amount,
|
amountOfThisGood: amount,
|
||||||
unitCode: unitCode || "HUR",
|
unitCode: unitCode || "HUR",
|
||||||
};
|
};
|
||||||
@@ -857,10 +852,7 @@ export function hydrateOffer(
|
|||||||
? R.clone(vcClaimOrig)
|
? R.clone(vcClaimOrig)
|
||||||
: {
|
: {
|
||||||
"@context": SCHEMA_ORG_CONTEXT,
|
"@context": SCHEMA_ORG_CONTEXT,
|
||||||
"@type": "OfferAction",
|
"@type": "Offer",
|
||||||
object: undefined,
|
|
||||||
agent: undefined,
|
|
||||||
itemOffered: {},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (lastClaimId) {
|
if (lastClaimId) {
|
||||||
|
|||||||
@@ -504,10 +504,6 @@ export default class ContactQRScanShow extends Vue {
|
|||||||
const contact = {
|
const contact = {
|
||||||
did: did,
|
did: did,
|
||||||
name: contactInfo.name || "",
|
name: contactInfo.name || "",
|
||||||
email: contactInfo.email || "",
|
|
||||||
phone: contactInfo.phone || "",
|
|
||||||
company: contactInfo.company || "",
|
|
||||||
title: contactInfo.title || "",
|
|
||||||
notes: contactInfo.notes || "",
|
notes: contactInfo.notes || "",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user