From 3f13d3ea3355fc6c1ccdfd6421b66ff30a282533 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Mon, 10 Jul 2023 19:03:20 +0800 Subject: [PATCH] CLeanup header creation --- src/views/ContactAmountsView.vue | 12 ++---------- src/views/ContactsView.vue | 12 ++---------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/views/ContactAmountsView.vue b/src/views/ContactAmountsView.vue index 641112d0..ca01ea42 100644 --- a/src/views/ContactAmountsView.vue +++ b/src/views/ContactAmountsView.vue @@ -166,11 +166,7 @@ export default class ContactsView extends Vue { encodeURIComponent(identity.did) + "&recipientDid=" + encodeURIComponent(contact.did); - const token = await accessToken(identity); - const headers = { - "Content-Type": "application/json", - Authorization: "Bearer " + token, - }; + const headers = this.getHeaders(identity); const resp = await this.axios.get(url, { headers }); if (resp.status === 200) { result = resp.data.data; @@ -191,11 +187,7 @@ export default class ContactsView extends Vue { encodeURIComponent(contact.did) + "&recipientDid=" + encodeURIComponent(identity.did); - const token2 = await accessToken(identity); - const headers2 = { - "Content-Type": "application/json", - Authorization: "Bearer " + token2, - }; + const headers2 = await this.getHeaders(identity); const resp2 = await this.axios.get(url2, { headers: headers2 }); if (resp2.status === 200) { result = R.concat(result, resp2.data.data); diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index 666215e9..57b69cf0 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -457,11 +457,7 @@ export default class ContactsView 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 headers = { - "Content-Type": "application/json", - Authorization: "Bearer " + token, - }; + const headers = await this.getHeaders(identity); try { const resp = await this.axios.post(url, payload, { headers }); @@ -683,11 +679,7 @@ export default class ContactsView extends Vue { const payload = JSON.stringify({ jwtEncoded: vcJwt }); const url = this.apiServer + "/api/v2/claim"; - const token = await accessToken(identity); - const headers = { - "Content-Type": "application/json", - Authorization: "Bearer " + token, - }; + const headers = await this.getHeaders(identity); try { const resp = await this.axios.post(url, payload, { headers });