Skip to content

Commit

Permalink
only update token when it is set by cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
Konard committed Aug 8, 2023
1 parent c8e2ee4 commit 38ed4c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@ app.get(['/file'], createProxyMiddleware({
if (tokenCookie) {
token = JSON.parse(tokenCookie)?.value;
console.log('/file get proxy', 'cookie token', token);
if (token) {
req.headers.authorization = `Bearer ${token}`;
}
console.log('/file get proxy', 'cookie token is set as header token');
}
}
console.log('/file get proxy', 'result token', token);

req.headers.authorization = `Bearer ${token}`;

const deep = makeDeepClient(token);
const linkId = req.query.linkId;
const result = await deep.apolloClient.query({
Expand Down

0 comments on commit 38ed4c8

Please sign in to comment.