change accessToken to take a DID

This commit is contained in:
2024-07-09 19:20:05 -06:00
parent 45f0a14661
commit bce003e508
15 changed files with 47 additions and 192 deletions

View File

@@ -282,7 +282,7 @@ export default class ContactAmountssView extends Vue {
};
// Make a payload for the claim
const vcPayload = {
const vcPayload: didJwt.JWTPayload = {
vc: {
"@context": ["https://www.w3.org/2018/credentials/v1"],
type: ["VerifiableCredential"],
@@ -307,7 +307,7 @@ export default class ContactAmountssView extends Vue {
// Make the xhr request payload
const payload = JSON.stringify({ jwtEncoded: vcJwt });
const url = this.apiServer + "/api/v2/claim";
const token = await accessToken(identity);
const token = await accessToken(this.activeDid);
const headers = {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
@@ -316,7 +316,8 @@ export default class ContactAmountssView extends Vue {
try {
const resp = await this.axios.post(url, payload, { headers });
if (resp.data?.success) {
record.amountConfirmed = origClaim.object?.amountOfThisGood || 1;
record.amountConfirmed =
(origClaim.object?.amountOfThisGood as number) || 1;
}
} catch (error) {
let userMessage = "There was an error. See logs for more info.";