Skip to content

Commit

Permalink
use browser request props conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Ingram committed Jul 30, 2024
1 parent 359a4e2 commit 56a5f21
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,13 @@ async function request(
method: reqMethod,
headers: reqHeaders,
body: reqBody,
credentials: 'include',
mode: 'cors',
// Credentials and mode are only available in the browser
...(typeof window !== 'undefined' && window.document
? {
credentials: 'include',
mode: 'cors',
}
: undefined),
});

const responseSession = response.headers.get('X-Session');
Expand Down

0 comments on commit 56a5f21

Please sign in to comment.