Skip to content

Commit afd571c

Browse files
committed
Passing token down from App
Client using it for contacts search
1 parent c30b3ac commit afd571c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/client/src/App.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ function AuthenticatedApp() {
102102
(!access_token | jwtExpired) ? <Login setToken={setToken} /> : <Switch>
103103

104104
<Route exact path="/">
105-
<HomePage/>
105+
<HomePage access_token = {access_token}/>
106106
</Route>
107107

108108

109109
{ /* If an admin, render Upload page */
110110
userRole === 'admin' &&
111111
<Route path="/admin">
112-
<Admin/>
112+
<Admin access_token = {access_token}/>
113113
</Route>
114114
}
115115

@@ -119,11 +119,11 @@ function AuthenticatedApp() {
119119
</Route>
120120

121121
<Route path="/360view/search">
122-
<Search360/>
122+
<Search360 access_token = {access_token} />
123123
</Route>
124124

125125
<Route path="/360view/view">
126-
<View360/>
126+
<View360 access_token = {access_token} />
127127
</Route>
128128

129129
<Route path="/check">

src/client/src/pages/DataView360/Search/Search.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,15 @@ class Search360 extends Component {
170170
this.setState({isDataBusy: true, search_participant: search_participant});
171171

172172
await new Promise(resolve => setTimeout(resolve, 1000));
173-
let response = await fetch(`/api/contacts/${search_participant}`);
173+
let response = await fetch(`/api/contacts/${search_participant}`,
174+
{
175+
method: 'GET',
176+
headers: {
177+
'Content-Type': 'application/json',
178+
'Authorization': 'Bearer ' + this.props.access_token
179+
}
180+
}
181+
);
174182
response = await response.json();
175183

176184
await this.setState({participantList: response.result})

0 commit comments

Comments
 (0)