forked from jsnbuchanan/crowd-funder-for-time-pwa
remove remaining getIdentity calls & fix QR code for did:peer
This commit is contained in:
@@ -235,7 +235,6 @@ import { accountsDB, db } from "@/db/index";
|
||||
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
|
||||
import { accessToken } from "@/libs/crypto";
|
||||
import * as libsUtil from "@/libs/util";
|
||||
import { IIdentifier } from "@veramo/core";
|
||||
import InfiniteScroll from "@/components/InfiniteScroll.vue";
|
||||
import QuickNav from "@/components/QuickNav.vue";
|
||||
import ProjectIcon from "@/components/ProjectIcon.vue";
|
||||
@@ -255,9 +254,9 @@ export default class ProjectsView extends Vue {
|
||||
);
|
||||
}
|
||||
|
||||
activeDid = "";
|
||||
apiServer = "";
|
||||
projects: PlanData[] = [];
|
||||
currentIid: IIdentifier;
|
||||
isLoading = false;
|
||||
isRegistered = false;
|
||||
numAccounts = 0;
|
||||
@@ -271,7 +270,7 @@ export default class ProjectsView extends Vue {
|
||||
try {
|
||||
await db.open();
|
||||
const settings = await db.settings.get(MASTER_SETTINGS_KEY);
|
||||
const activeDid: string = (settings?.activeDid as string) || "";
|
||||
this.activeDid = (settings?.activeDid as string) || "";
|
||||
this.apiServer = (settings?.apiServer as string) || "";
|
||||
this.isRegistered = !!settings?.isRegistered;
|
||||
|
||||
@@ -281,7 +280,6 @@ export default class ProjectsView extends Vue {
|
||||
console.error("No accounts found.");
|
||||
this.errNote("You need an identifier to load your projects.");
|
||||
} else {
|
||||
this.currentIid = await libsUtil.getIdentity(activeDid);
|
||||
await this.loadOffers();
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -342,7 +340,7 @@ export default class ProjectsView extends Vue {
|
||||
if (this.projects.length > 0 && payload) {
|
||||
const latestProject = this.projects[this.projects.length - 1];
|
||||
await this.loadProjects(
|
||||
this.currentIid,
|
||||
this.activeDid,
|
||||
`beforeId=${latestProject.rowid}`,
|
||||
);
|
||||
}
|
||||
@@ -350,13 +348,12 @@ export default class ProjectsView extends Vue {
|
||||
|
||||
/**
|
||||
* Load projects initially
|
||||
* @param identifier of the user
|
||||
* @param issuerDid of the user
|
||||
* @param urlExtra additional url parameters in a string
|
||||
**/
|
||||
async loadProjects(identifier?: IIdentifier, urlExtra: string = "") {
|
||||
const identity = identifier || this.currentIid;
|
||||
async loadProjects(activeDid?: string, urlExtra: string = "") {
|
||||
const url = `${this.apiServer}/api/v2/report/plansByIssuer?${urlExtra}`;
|
||||
const token: string = await accessToken(identity.did);
|
||||
const token: string = await accessToken(activeDid);
|
||||
await this.projectDataLoader(url, token);
|
||||
}
|
||||
|
||||
@@ -446,19 +443,18 @@ export default class ProjectsView extends Vue {
|
||||
async loadMoreOfferData(payload: boolean) {
|
||||
if (this.offers.length > 0 && payload) {
|
||||
const latestOffer = this.offers[this.offers.length - 1];
|
||||
await this.loadOffers(this.currentIid, `&beforeId=${latestOffer.jwtId}`);
|
||||
await this.loadOffers(this.activeDid, `&beforeId=${latestOffer.jwtId}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load offers initially
|
||||
* @param identifier of the user
|
||||
* @param issuerDid of the user
|
||||
* @param urlExtra additional url parameters in a string
|
||||
**/
|
||||
async loadOffers(identifier?: IIdentifier, urlExtra: string = "") {
|
||||
const identity = identifier || this.currentIid;
|
||||
const url = `${this.apiServer}/api/v2/report/offers?offeredByDid=${identity.did}${urlExtra}`;
|
||||
const token: string = await accessToken(identity.did);
|
||||
async loadOffers(issuerDid?: string, urlExtra: string = "") {
|
||||
const url = `${this.apiServer}/api/v2/report/offers?offeredByDid=${issuerDid}${urlExtra}`;
|
||||
const token: string = await accessToken(issuerDid);
|
||||
await this.offerDataLoader(url, token);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user