Skip to content

Commit e1f93c0

Browse files
committed
Added Bearer auth hdr to client request code
1 parent afd571c commit e1f93c0

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

src/client/src/pages/Admin.js

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/client/src/pages/DataView360/View/View.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ class View360 extends Component {
5454
});
5555

5656
await new Promise(resolve => setTimeout(resolve, 1000));
57-
let response = await fetch(`/api/360/${this.state.matchId}`);
57+
let response = await fetch(`/api/360/${this.state.matchId}`,
58+
{
59+
method: 'GET',
60+
headers: {
61+
'Content-Type': 'application/json',
62+
'Authorization': 'Bearer ' + this.props.access_token
63+
}
64+
} );
5865
response = await response.json();
5966

6067
this.setState({

0 commit comments

Comments
 (0)