fix some incorrect logic & things AI hallucinated

This commit is contained in:
2025-05-29 19:36:35 -06:00
parent 9760f02aab
commit 8c42166d36
4 changed files with 7 additions and 34 deletions

View File

@@ -320,10 +320,7 @@ export default class GiftedDialog extends Vue {
this.fromProjectId,
);
if (
result.type === "error" ||
this.isGiveCreationError(result.response)
) {
if (!result.success || result.error) {
const errorMessage = this.getGiveCreationErrorMessage(result);
logger.error("Error with give creation result:", result);
this.$notify(
@@ -370,15 +367,6 @@ export default class GiftedDialog extends Vue {
// 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")
* @returns best guess at an error message

View File

@@ -1,6 +1,6 @@
// similar to VerifiableCredentialSubject... maybe rename this
export interface GenericVerifiableCredential {
"@context": string | string[];
"@context"?: string;
"@type": string;
[key: string]: unknown;
}
@@ -50,7 +50,7 @@ export interface KeyMeta {
export interface QuantitativeValue extends GenericVerifiableCredential {
"@type": "QuantitativeValue";
"@context": string | string[];
"@context"?: string;
amountOfThisGood: number;
unitCode: string;
[key: string]: unknown;
@@ -102,7 +102,7 @@ export interface Agent {
export interface ClaimObject {
"@type": string;
"@context"?: string | string[];
"@context"?: string;
fulfills?: Array<{
"@type": string;
identifier?: string;
@@ -119,7 +119,7 @@ export interface ClaimObject {
}
export interface VerifiableCredentialClaim {
"@context": string | string[];
"@context"?: string;
"@type": string;
type: string[];
credentialSubject: ClaimObject;
@@ -128,7 +128,6 @@ export interface VerifiableCredentialClaim {
export interface GiveVerifiableCredential extends GenericVerifiableCredential {
"@type": "GiveAction";
"@context": string | string[];
object?: GenericVerifiableCredential;
agent?: Agent;
participant?: {
@@ -144,8 +143,7 @@ export interface GiveVerifiableCredential extends GenericVerifiableCredential {
}
export interface OfferVerifiableCredential extends GenericVerifiableCredential {
"@type": "OfferAction";
"@context": string | string[];
"@type": "Offer";
object?: GenericVerifiableCredential;
agent?: Agent;
participant?: {
@@ -167,7 +165,6 @@ export interface OfferVerifiableCredential extends GenericVerifiableCredential {
export interface RegisterVerifiableCredential
extends GenericVerifiableCredential {
"@type": "RegisterAction";
"@context": string | string[];
agent: {
identifier: string;
};

View File

@@ -668,9 +668,6 @@ export function hydrateGive(
: {
"@context": SCHEMA_ORG_CONTEXT,
"@type": "GiveAction",
object: undefined,
agent: undefined,
fulfills: [],
};
if (lastClaimId) {
@@ -688,8 +685,6 @@ export function hydrateGive(
if (amount && !isNaN(amount)) {
const quantitativeValue: QuantitativeValue = {
"@context": SCHEMA_ORG_CONTEXT,
"@type": "QuantitativeValue",
amountOfThisGood: amount,
unitCode: unitCode || "HUR",
};
@@ -857,10 +852,7 @@ export function hydrateOffer(
? R.clone(vcClaimOrig)
: {
"@context": SCHEMA_ORG_CONTEXT,
"@type": "OfferAction",
object: undefined,
agent: undefined,
itemOffered: {},
"@type": "Offer",
};
if (lastClaimId) {

View File

@@ -504,10 +504,6 @@ export default class ContactQRScanShow extends Vue {
const contact = {
did: did,
name: contactInfo.name || "",
email: contactInfo.email || "",
phone: contactInfo.phone || "",
company: contactInfo.company || "",
title: contactInfo.title || "",
notes: contactInfo.notes || "",
};