change accessToken to take a DID
This commit is contained in:
@@ -258,23 +258,17 @@ export default class NewEditProjectView extends Vue {
|
||||
if (this.numAccounts === 0) {
|
||||
this.errNote("There was a problem loading your account info.");
|
||||
} else {
|
||||
const identity = await this.getIdentity(this.activeDid);
|
||||
if (!identity) {
|
||||
throw new Error(
|
||||
"An ID is chosen but there are no keys for it so it cannot be used to talk with the service. Switch your ID.",
|
||||
);
|
||||
}
|
||||
this.loadProject(identity);
|
||||
this.loadProject(this.activeDid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async loadProject(identity: IIdentifier) {
|
||||
async loadProject(userDid: string) {
|
||||
const url =
|
||||
this.apiServer +
|
||||
"/api/claim/byHandle/" +
|
||||
encodeURIComponent(this.projectId);
|
||||
const token = await accessToken(identity);
|
||||
const token = await accessToken(userDid);
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + token,
|
||||
@@ -333,8 +327,7 @@ export default class NewEditProjectView extends Vue {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const identity = await libsUtil.getIdentity(this.activeDid);
|
||||
const token = await accessToken(identity);
|
||||
const token = await accessToken(this.activeDid);
|
||||
const response = await this.axios.delete(
|
||||
DEFAULT_IMAGE_API_SERVER +
|
||||
"/image/" +
|
||||
@@ -464,7 +457,7 @@ export default class NewEditProjectView extends Vue {
|
||||
|
||||
const payload = JSON.stringify({ jwtEncoded: vcJwt });
|
||||
const url = this.apiServer + "/api/v2/claim";
|
||||
const token = await accessToken(identity);
|
||||
const token = await accessToken(identity.did);
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + token,
|
||||
|
||||
Reference in New Issue
Block a user