@@ -78,7 +78,13 @@ class Admin extends Component {
78
78
formData . append ( 'file' , element , element . name )
79
79
} )
80
80
81
- await fetch ( "/api/file" , { method : 'POST' , body : formData } )
81
+ await fetch ( "/api/file" , { method : 'POST' , body : formData ,
82
+ headers : {
83
+ 'Content-Type' : 'application/json' ,
84
+ 'Authorization' : 'Bearer ' + this . props . access_token
85
+ } } )
86
+
87
+
82
88
83
89
await this . handleGetFileList ( ) ;
84
90
@@ -95,13 +101,27 @@ class Admin extends Component {
95
101
96
102
this . setState ( { isLoading : true } ) ;
97
103
98
- await fetch ( '/api/execute' ) ;
104
+ await fetch ( '/api/execute' ,
105
+ {
106
+ method : 'GET' ,
107
+ headers : {
108
+ 'Content-Type' : 'application/json' ,
109
+ 'Authorization' : 'Bearer ' + this . props . access_token
110
+ }
111
+ } ) ;
99
112
100
113
this . refreshPage ( ) ;
101
114
}
102
115
103
116
async handleGetStatistics ( ) {
104
- const statsData = await fetch ( "/api/statistics" ) ;
117
+ const statsData = await fetch ( "/api/statistics" ,
118
+ {
119
+ method : 'GET' ,
120
+ headers : {
121
+ 'Content-Type' : 'application/json' ,
122
+ 'Authorization' : 'Bearer ' + this . props . access_token
123
+ }
124
+ } ) ;
105
125
const statsResponse = await statsData . json ( )
106
126
107
127
if ( statsResponse !== 'executing' ) {
@@ -115,7 +135,14 @@ class Admin extends Component {
115
135
}
116
136
117
137
async handleGetFileList ( ) {
118
- const filesData = await fetch ( "/api/listCurrentFiles" ) ;
138
+ const filesData = await fetch ( "/api/listCurrentFiles" ,
139
+ {
140
+ method : 'GET' ,
141
+ headers : {
142
+ 'Content-Type' : 'application/json' ,
143
+ 'Authorization' : 'Bearer ' + this . props . access_token
144
+ }
145
+ } ) ;
119
146
const filesResponse = await filesData . json ( ) ;
120
147
this . setState ( { fileListHtml : filesResponse } ) ;
121
148
}
0 commit comments