forked from jsnbuchanan/crowd-funder-for-time-pwa
change the contact-sharing data into a JWT for the contact-import page
This commit is contained in:
@@ -323,7 +323,7 @@ import GiftedDialog from "@/components/GiftedDialog.vue";
|
||||
import OfferDialog from "@/components/OfferDialog.vue";
|
||||
import ContactNameDialog from "@/components/ContactNameDialog.vue";
|
||||
import TopMessage from "@/components/TopMessage.vue";
|
||||
import { AppString, NotificationIface } from "@/constants/app";
|
||||
import { APP_SERVER, AppString, NotificationIface } from "@/constants/app";
|
||||
import {
|
||||
db,
|
||||
retrieveSettingsForActiveAccount,
|
||||
@@ -336,6 +336,7 @@ import { decodeEndorserJwt } from "@/libs/crypto/vc";
|
||||
import {
|
||||
CONTACT_CSV_HEADER,
|
||||
CONTACT_URL_PREFIX,
|
||||
createEndorserJwtForDid,
|
||||
GiveSummaryRecord,
|
||||
getHeaders,
|
||||
isDid,
|
||||
@@ -415,6 +416,7 @@ export default class ContactsView extends Vue {
|
||||
);
|
||||
|
||||
// handle a contact sent via URL
|
||||
// @deprecated: use /contact-import/:jwt with a JWT that has an array of contacts
|
||||
const importedContactJwt = (this.$route as RouteLocationNormalizedLoaded)
|
||||
.query["contactJwt"] as string;
|
||||
if (importedContactJwt) {
|
||||
@@ -1247,7 +1249,7 @@ export default class ContactsView extends Vue {
|
||||
};
|
||||
}
|
||||
|
||||
private copySelectedContacts() {
|
||||
private async copySelectedContacts() {
|
||||
if (this.contactsSelected.length === 0) {
|
||||
this.danger("You must select contacts to copy.");
|
||||
return;
|
||||
@@ -1255,18 +1257,23 @@ export default class ContactsView extends Vue {
|
||||
const selectedContacts = this.contacts.filter((c) =>
|
||||
this.contactsSelected.includes(c.did),
|
||||
);
|
||||
const message =
|
||||
"To add contacts, paste this into the box on the 'Contacts' screen.\n\n" +
|
||||
JSON.stringify(selectedContacts);
|
||||
console.log(
|
||||
"Array of selected contacts:",
|
||||
JSON.stringify(selectedContacts),
|
||||
);
|
||||
const contactsJwt = await createEndorserJwtForDid(this.activeDid, {
|
||||
contacts: selectedContacts,
|
||||
});
|
||||
const contactsJwtUrl = APP_SERVER + "/contact-import/" + contactsJwt;
|
||||
useClipboard()
|
||||
.copy(message)
|
||||
.copy(contactsJwtUrl)
|
||||
.then(() => {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "info",
|
||||
title: "Copied",
|
||||
text: "Those contacts were copied to the clipboard. Have them paste it in the box on their 'Contacts' screen.",
|
||||
text: "The link for those contacts is now in the clipboard.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user