Updates to contacts UI. Sweep for buildIdentity and buildHeaders

This commit is contained in:
Matthew Raymer
2023-07-07 18:28:06 +08:00
parent 5d49965166
commit 08137eb000
7 changed files with 250 additions and 224 deletions

View File

@@ -101,6 +101,29 @@ export default class NewEditProjectView extends Vue {
description = "";
errorMessage = "";
public async getIdentity(activeDid) {
await accountsDB.open();
const accounts = await accountsDB.accounts.toArray();
const account = R.find((acc) => acc.did === activeDid, accounts);
const identity = JSON.parse(account?.identity || "null");
if (!identity) {
throw new Error(
"Attempted to load Give records with no identity available.",
);
}
return identity;
}
public async getHeaders(identity) {
const token = await accessToken(identity);
const headers = {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
};
return headers;
}
projectId = localStorage.getItem("projectId") || "";
isHiddenSave = false;
isHiddenSpinner = true;