Skip to content

Commit

Permalink
fix(admin-ui): Fix channel header when using bearer auth
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Aug 26, 2020
1 parent 5da5b4e commit fa29805
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions packages/admin-ui/src/lib/core/src/data/data.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,18 @@ export function createApollo(
new OmitTypenameLink(),
new CheckJobsLink(injector),
setContext(() => {
const headers: Record<string, string> = {};
const channelToken = localStorageService.get('activeChannelToken');
if (channelToken) {
return {
headers: {
'vendure-token': channelToken,
},
};
headers['vendure-token'] = channelToken;
}
}),
setContext(() => {
if (tokenMethod === 'bearer') {
const authToken = localStorageService.get('authToken');
if (authToken) {
return {
headers: {
authorization: `Bearer ${authToken}`,
},
};
headers.authorization = `Bearer ${authToken}`;
}
}
return { headers };
}),
createUploadLink({
uri: `${serverLocation}/${adminApiPath}`,
Expand Down

0 comments on commit fa29805

Please sign in to comment.