@@ -78,7 +78,13 @@ class Admin extends Component {
7878 formData . append ( 'file' , element , element . name )
7979 } )
8080
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+
8288
8389 await this . handleGetFileList ( ) ;
8490
@@ -95,13 +101,27 @@ class Admin extends Component {
95101
96102 this . setState ( { isLoading : true } ) ;
97103
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+ } ) ;
99112
100113 this . refreshPage ( ) ;
101114 }
102115
103116 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+ } ) ;
105125 const statsResponse = await statsData . json ( )
106126
107127 if ( statsResponse !== 'executing' ) {
@@ -115,7 +135,14 @@ class Admin extends Component {
115135 }
116136
117137 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+ } ) ;
119146 const filesResponse = await filesData . json ( ) ;
120147 this . setState ( { fileListHtml : filesResponse } ) ;
121148 }
0 commit comments