forked from trent_larson/crowd-funder-for-time-pwa
Fix parameter passing in contact gift dialogs
- Replace @Emit decorator with direct $emit calls in ContactListItem - Fix DID comparison from loose to strict equality in nameForDid function - Resolve issue where giver/recipient names showed as "this unnamed user" The @Emit decorator was not properly spreading array parameters, causing the parent component to receive arrays instead of separate string parameters.
This commit is contained in:
@@ -121,6 +121,12 @@ import { AppString } from "../constants/app";
|
|||||||
components: {
|
components: {
|
||||||
EntityIcon,
|
EntityIcon,
|
||||||
},
|
},
|
||||||
|
emits: [
|
||||||
|
"toggle-selection",
|
||||||
|
"show-identicon",
|
||||||
|
"show-gifted-dialog",
|
||||||
|
"open-offer-dialog",
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export default class ContactListItem extends Vue {
|
export default class ContactListItem extends Vue {
|
||||||
@Prop({ required: true }) contact!: Contact;
|
@Prop({ required: true }) contact!: Contact;
|
||||||
@@ -151,14 +157,12 @@ export default class ContactListItem extends Vue {
|
|||||||
return contact;
|
return contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Emit("show-gifted-dialog")
|
|
||||||
emitShowGiftedDialog(fromDid: string, toDid: string) {
|
emitShowGiftedDialog(fromDid: string, toDid: string) {
|
||||||
return { fromDid, toDid };
|
this.$emit("show-gifted-dialog", fromDid, toDid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Emit("open-offer-dialog")
|
|
||||||
emitOpenOfferDialog(did: string, name: string | undefined) {
|
emitOpenOfferDialog(did: string, name: string | undefined) {
|
||||||
return { did, name };
|
this.$emit("open-offer-dialog", did, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -191,9 +191,9 @@ export const nameForDid = (
|
|||||||
did: string,
|
did: string,
|
||||||
): string => {
|
): string => {
|
||||||
if (did === activeDid) {
|
if (did === activeDid) {
|
||||||
return "you";
|
return "You";
|
||||||
}
|
}
|
||||||
const contact = R.find((con) => con.did == did, contacts);
|
const contact = R.find((con) => con.did === did, contacts);
|
||||||
return nameForContact(contact);
|
return nameForContact(contact);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user