forked from jsnbuchanan/crowd-funder-for-time-pwa
allow to switch the server
This commit is contained in:
@@ -271,6 +271,7 @@ const Buffer = require("buffer/").Buffer;
|
||||
})
|
||||
export default class ContactsView extends Vue {
|
||||
activeDid = "";
|
||||
apiServer = "";
|
||||
contacts: Array<Contact> = [];
|
||||
contactInput = "";
|
||||
// { "did:...": concatenated-descriptions } entry for each contact
|
||||
@@ -296,6 +297,7 @@ export default class ContactsView extends Vue {
|
||||
await db.open();
|
||||
const settings = await db.settings.get(MASTER_SETTINGS_KEY);
|
||||
this.activeDid = settings?.activeDid || "";
|
||||
this.apiServer = settings?.apiServer || "";
|
||||
|
||||
this.showGiveNumbers = !!settings?.showContactGivesInline;
|
||||
if (this.showGiveNumbers) {
|
||||
@@ -321,12 +323,10 @@ export default class ContactsView extends Vue {
|
||||
return;
|
||||
}
|
||||
|
||||
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER;
|
||||
|
||||
// load all the time I have given
|
||||
try {
|
||||
const url =
|
||||
endorserApiServer +
|
||||
this.apiServer +
|
||||
"/api/v2/report/gives?agentDid=" +
|
||||
encodeURIComponent(identity.did);
|
||||
const token = await accessToken(identity);
|
||||
@@ -335,7 +335,7 @@ export default class ContactsView extends Vue {
|
||||
Authorization: "Bearer " + token,
|
||||
};
|
||||
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) {
|
||||
const contactDescriptions: Record<string, string> = {};
|
||||
const contactConfirmed: Record<string, number> = {};
|
||||
@@ -381,7 +381,7 @@ export default class ContactsView extends Vue {
|
||||
// load all the time I have received
|
||||
try {
|
||||
const url =
|
||||
endorserApiServer +
|
||||
this.apiServer +
|
||||
"/api/v2/report/gives?recipientDid=" +
|
||||
encodeURIComponent(identity.did);
|
||||
const token = await accessToken(identity);
|
||||
@@ -390,7 +390,7 @@ export default class ContactsView extends Vue {
|
||||
Authorization: "Bearer " + token,
|
||||
};
|
||||
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) {
|
||||
const contactDescriptions: Record<string, string> = {};
|
||||
const contactConfirmed: Record<string, number> = {};
|
||||
@@ -520,8 +520,7 @@ export default class ContactsView extends Vue {
|
||||
|
||||
// Make the xhr request payload
|
||||
const payload = JSON.stringify({ jwtEncoded: vcJwt });
|
||||
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER;
|
||||
const url = endorserApiServer + "/api/v2/claim";
|
||||
const url = this.apiServer + "/api/v2/claim";
|
||||
const token = await accessToken(identity);
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
@@ -561,9 +560,8 @@ export default class ContactsView extends Vue {
|
||||
}
|
||||
|
||||
async setVisibility(contact: Contact, visibility: boolean) {
|
||||
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER;
|
||||
const url =
|
||||
endorserApiServer +
|
||||
this.apiServer +
|
||||
"/api/report/" +
|
||||
(visibility ? "canSeeMe" : "cannotSeeMe");
|
||||
await accountsDB.open();
|
||||
@@ -601,9 +599,8 @@ export default class ContactsView extends Vue {
|
||||
}
|
||||
|
||||
async checkVisibility(contact: Contact) {
|
||||
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER;
|
||||
const url =
|
||||
endorserApiServer +
|
||||
this.apiServer +
|
||||
"/api/report/canDidExplicitlySeeMe?did=" +
|
||||
encodeURIComponent(contact.did);
|
||||
await accountsDB.open();
|
||||
@@ -774,8 +771,7 @@ export default class ContactsView extends Vue {
|
||||
// Make the xhr request payload
|
||||
|
||||
const payload = JSON.stringify({ jwtEncoded: vcJwt });
|
||||
const endorserApiServer = AppString.DEFAULT_ENDORSER_API_SERVER;
|
||||
const url = endorserApiServer + "/api/v2/claim";
|
||||
const url = this.apiServer + "/api/v2/claim";
|
||||
const token = await accessToken(identity);
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
|
||||
Reference in New Issue
Block a user