Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
fix(client): fix incorrect token condition (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricokahler authored Feb 18, 2021
1 parent 941ea18 commit d82a0e2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-codegen",
"version": "0.9.0",
"version": "0.9.1",
"private": true,
"description": "",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/client/create-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ function createClient<Documents extends { _type: string; _id: string }>({
}.sanity.io/v1/data/query/${dataset}?${searchParams.toString()}`,
{
// conditionally add the authorization header if the token is present
...(preview && { headers: { Authorization: `Bearer ${token}` } }),
...(token &&
!useCdn && { headers: { Authorization: `Bearer ${token}` } }),
}
);

Expand Down

0 comments on commit d82a0e2

Please sign in to comment.