forked from jsnbuchanan/crowd-funder-for-time-pwa
cache the passkey JWANT access token for multiple signatures
This commit is contained in:
@@ -233,13 +233,16 @@ import { Component, Vue } from "vue-facing-decorator";
|
||||
import { NotificationIface } from "@/constants/app";
|
||||
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 InfiniteScroll from "@/components/InfiniteScroll.vue";
|
||||
import QuickNav from "@/components/QuickNav.vue";
|
||||
import ProjectIcon from "@/components/ProjectIcon.vue";
|
||||
import TopMessage from "@/components/TopMessage.vue";
|
||||
import { OfferSummaryRecord, PlanData } from "@/libs/endorserServer";
|
||||
import {
|
||||
getHeaders,
|
||||
OfferSummaryRecord,
|
||||
PlanData,
|
||||
} from "@/libs/endorserServer";
|
||||
import EntityIcon from "@/components/EntityIcon.vue";
|
||||
|
||||
@Component({
|
||||
@@ -293,13 +296,9 @@ export default class ProjectsView extends Vue {
|
||||
* @param url the url used to fetch the data
|
||||
* @param token Authorization token
|
||||
**/
|
||||
async projectDataLoader(url: string, token: string) {
|
||||
const headers: { [key: string]: string } = {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
|
||||
async projectDataLoader(url: string) {
|
||||
try {
|
||||
const headers = await getHeaders(this.activeDid);
|
||||
this.isLoading = true;
|
||||
const resp = await this.axios.get(url, { headers } as AxiosRequestConfig);
|
||||
if (resp.status === 200 && resp.data.data) {
|
||||
@@ -353,8 +352,7 @@ export default class ProjectsView extends Vue {
|
||||
**/
|
||||
async loadProjects(activeDid?: string, urlExtra: string = "") {
|
||||
const url = `${this.apiServer}/api/v2/report/plansByIssuer?${urlExtra}`;
|
||||
const token: string = await accessToken(activeDid);
|
||||
await this.projectDataLoader(url, token);
|
||||
await this.projectDataLoader(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -392,11 +390,8 @@ export default class ProjectsView extends Vue {
|
||||
* @param url the url used to fetch the data
|
||||
* @param token Authorization token
|
||||
**/
|
||||
async offerDataLoader(url: string, token: string) {
|
||||
const headers: { [key: string]: string } = {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
async offerDataLoader(url: string) {
|
||||
const headers = getHeaders(this.activeDid);
|
||||
|
||||
try {
|
||||
this.isLoading = true;
|
||||
@@ -454,8 +449,7 @@ export default class ProjectsView extends Vue {
|
||||
**/
|
||||
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);
|
||||
await this.offerDataLoader(url);
|
||||
}
|
||||
|
||||
public computedOfferTabClassNames() {
|
||||
|
||||
Reference in New Issue
Block a user