File tree Expand file tree Collapse file tree 3 files changed +24
-11
lines changed Expand file tree Collapse file tree 3 files changed +24
-11
lines changed Original file line number Diff line number Diff line change 1
1
import { ref } from 'vue'
2
+ import axios from 'axios'
2
3
3
4
type ContentfulOptions = {
4
5
readonly spaceId : string
@@ -20,17 +21,15 @@ export const useContentful = <T>(
20
21
21
22
const URI = `https://graphql.contentful.com/content/v1/spaces/${ spaceId } `
22
23
23
- const options : RequestInit = {
24
- method : 'POST' ,
25
- headers : {
26
- Authorization : `Bearer ${ token } ` ,
27
- 'Content-Type' : 'application/json' ,
28
- } ,
29
- body : JSON . stringify ( { query } ) ,
30
- }
31
-
32
- fetch ( URI , options )
33
- . then ( ( response ) => response . json ( ) as Promise < ContentfulResponse < T > > )
24
+ axios
25
+ . post < ContentfulResponse < T > > ( URI , {
26
+ headers : {
27
+ Authorization : `Bearer ${ token } ` ,
28
+ 'Content-Type' : 'application/json' ,
29
+ } ,
30
+ body : JSON . stringify ( { query } ) ,
31
+ } )
32
+ . then ( ( { data } ) => data )
34
33
. then ( ( { data : response , errors : contenfulErrors } ) => {
35
34
isLoading . value = false
36
35
Original file line number Diff line number Diff line change 47
47
"@typescript-eslint/eslint-plugin" : " 5.15.0" ,
48
48
"@typescript-eslint/parser" : " 5.15.0" ,
49
49
"all-contributors-cli" : " 6.20.0" ,
50
+ "axios" : " ^0.26.1" ,
50
51
"concurrently" : " 7.0.0" ,
51
52
"conventional-changelog-conventionalcommits" : " 4.6.3" ,
52
53
"eslint" : " 8.11.0" ,
66
67
"vue" : " 3.2.31"
67
68
},
68
69
"peerDependencies" : {
70
+ "axios" : " ^0.26.1" ,
69
71
"vue" : " ^3.2.29"
70
72
}
71
73
}
Original file line number Diff line number Diff line change @@ -1523,6 +1523,13 @@ at-least-node@^1.0.0:
1523
1523
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
1524
1524
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
1525
1525
1526
+ axios@^0.26.1 :
1527
+ version "0.26.1"
1528
+ resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9"
1529
+ integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==
1530
+ dependencies :
1531
+ follow-redirects "^1.14.8"
1532
+
1526
1533
babel-jest@^27.5.1 :
1527
1534
version "27.5.1"
1528
1535
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.5.1.tgz#a1bf8d61928edfefd21da27eb86a695bfd691444"
@@ -2580,6 +2587,11 @@ flatted@^3.1.0, flatted@^3.2.4:
2580
2587
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3"
2581
2588
integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==
2582
2589
2590
+ follow-redirects@^1.14.8 :
2591
+ version "1.14.9"
2592
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
2593
+ integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==
2594
+
2583
2595
form-data@^3.0.0 :
2584
2596
version "3.0.1"
2585
2597
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
You can’t perform that action at this time.
0 commit comments