|
@ -271,6 +271,7 @@ const Buffer = require("buffer/").Buffer; |
|
|
}) |
|
|
}) |
|
|
export default class ContactsView extends Vue { |
|
|
export default class ContactsView extends Vue { |
|
|
activeDid = ""; |
|
|
activeDid = ""; |
|
|
|
|
|
apiServer = ""; |
|
|
contacts: Array<Contact> = []; |
|
|
contacts: Array<Contact> = []; |
|
|
contactInput = ""; |
|
|
contactInput = ""; |
|
|
// { "did:...": concatenated-descriptions } entry for each contact |
|
|
// { "did:...": concatenated-descriptions } entry for each contact |
|
@ -296,6 +297,7 @@ export default class ContactsView extends Vue { |
|
|
await db.open(); |
|
|
await db.open(); |
|
|
const settings = await db.settings.get(MASTER_SETTINGS_KEY); |
|
|
const settings = await db.settings.get(MASTER_SETTINGS_KEY); |
|
|
this.activeDid = settings?.activeDid || ""; |
|
|
this.activeDid = settings?.activeDid || ""; |
|
|
|
|
|
this.apiServer = settings?.apiServer || ""; |
|
|
|
|
|
|
|
|
this.showGiveNumbers = !!settings?.showContactGivesInline; |
|
|
this.showGiveNumbers = !!settings?.showContactGivesInline; |
|
|
if (this.showGiveNumbers) { |
|
|
if (this.showGiveNumbers) { |
|
@ -321,12 +323,10 @@ export default class ContactsView extends Vue { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER; |
|
|
|
|
|
|
|
|
|
|
|
// load all the time I have given |
|
|
// load all the time I have given |
|
|
try { |
|
|
try { |
|
|
const url = |
|
|
const url = |
|
|
endorserApiServer + |
|
|
this.apiServer + |
|
|
"/api/v2/report/gives?agentDid=" + |
|
|
"/api/v2/report/gives?agentDid=" + |
|
|
encodeURIComponent(identity.did); |
|
|
encodeURIComponent(identity.did); |
|
|
const token = await accessToken(identity); |
|
|
const token = await accessToken(identity); |
|
@ -335,7 +335,7 @@ export default class ContactsView extends Vue { |
|
|
Authorization: "Bearer " + token, |
|
|
Authorization: "Bearer " + token, |
|
|
}; |
|
|
}; |
|
|
const resp = await this.axios.get(url, { headers }); |
|
|
const resp = await this.axios.get(url, { headers }); |
|
|
console.log("All gifts you've given:", resp.data); |
|
|
//console.log("All gifts you've given:", resp.data); |
|
|
if (resp.status === 200) { |
|
|
if (resp.status === 200) { |
|
|
const contactDescriptions: Record<string, string> = {}; |
|
|
const contactDescriptions: Record<string, string> = {}; |
|
|
const contactConfirmed: Record<string, number> = {}; |
|
|
const contactConfirmed: Record<string, number> = {}; |
|
@ -381,7 +381,7 @@ export default class ContactsView extends Vue { |
|
|
// load all the time I have received |
|
|
// load all the time I have received |
|
|
try { |
|
|
try { |
|
|
const url = |
|
|
const url = |
|
|
endorserApiServer + |
|
|
this.apiServer + |
|
|
"/api/v2/report/gives?recipientDid=" + |
|
|
"/api/v2/report/gives?recipientDid=" + |
|
|
encodeURIComponent(identity.did); |
|
|
encodeURIComponent(identity.did); |
|
|
const token = await accessToken(identity); |
|
|
const token = await accessToken(identity); |
|
@ -390,7 +390,7 @@ export default class ContactsView extends Vue { |
|
|
Authorization: "Bearer " + token, |
|
|
Authorization: "Bearer " + token, |
|
|
}; |
|
|
}; |
|
|
const resp = await this.axios.get(url, { headers }); |
|
|
const resp = await this.axios.get(url, { headers }); |
|
|
console.log("All gifts you've recieved:", resp.data); |
|
|
//console.log("All gifts you've recieved:", resp.data); |
|
|
if (resp.status === 200) { |
|
|
if (resp.status === 200) { |
|
|
const contactDescriptions: Record<string, string> = {}; |
|
|
const contactDescriptions: Record<string, string> = {}; |
|
|
const contactConfirmed: Record<string, number> = {}; |
|
|
const contactConfirmed: Record<string, number> = {}; |
|
@ -520,8 +520,7 @@ export default class ContactsView extends Vue { |
|
|
|
|
|
|
|
|
// Make the xhr request payload |
|
|
// Make the xhr request payload |
|
|
const payload = JSON.stringify({ jwtEncoded: vcJwt }); |
|
|
const payload = JSON.stringify({ jwtEncoded: vcJwt }); |
|
|
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER; |
|
|
const url = this.apiServer + "/api/v2/claim"; |
|
|
const url = endorserApiServer + "/api/v2/claim"; |
|
|
|
|
|
const token = await accessToken(identity); |
|
|
const token = await accessToken(identity); |
|
|
const headers = { |
|
|
const headers = { |
|
|
"Content-Type": "application/json", |
|
|
"Content-Type": "application/json", |
|
@ -561,9 +560,8 @@ export default class ContactsView extends Vue { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async setVisibility(contact: Contact, visibility: boolean) { |
|
|
async setVisibility(contact: Contact, visibility: boolean) { |
|
|
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER; |
|
|
|
|
|
const url = |
|
|
const url = |
|
|
endorserApiServer + |
|
|
this.apiServer + |
|
|
"/api/report/" + |
|
|
"/api/report/" + |
|
|
(visibility ? "canSeeMe" : "cannotSeeMe"); |
|
|
(visibility ? "canSeeMe" : "cannotSeeMe"); |
|
|
await accountsDB.open(); |
|
|
await accountsDB.open(); |
|
@ -601,9 +599,8 @@ export default class ContactsView extends Vue { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async checkVisibility(contact: Contact) { |
|
|
async checkVisibility(contact: Contact) { |
|
|
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER; |
|
|
|
|
|
const url = |
|
|
const url = |
|
|
endorserApiServer + |
|
|
this.apiServer + |
|
|
"/api/report/canDidExplicitlySeeMe?did=" + |
|
|
"/api/report/canDidExplicitlySeeMe?did=" + |
|
|
encodeURIComponent(contact.did); |
|
|
encodeURIComponent(contact.did); |
|
|
await accountsDB.open(); |
|
|
await accountsDB.open(); |
|
@ -774,8 +771,7 @@ export default class ContactsView extends Vue { |
|
|
// Make the xhr request payload |
|
|
// Make the xhr request payload |
|
|
|
|
|
|
|
|
const payload = JSON.stringify({ jwtEncoded: vcJwt }); |
|
|
const payload = JSON.stringify({ jwtEncoded: vcJwt }); |
|
|
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER; |
|
|
const url = this.apiServer + "/api/v2/claim"; |
|
|
const url = endorserApiServer + "/api/v2/claim"; |
|
|
|
|
|
const token = await accessToken(identity); |
|
|
const token = await accessToken(identity); |
|
|
const headers = { |
|
|
const headers = { |
|
|
"Content-Type": "application/json", |
|
|
"Content-Type": "application/json", |
|
|