Skip to content

Commit

Permalink
Reapply "Remove hardcoded auth details from debugging"
Browse files Browse the repository at this point in the history
This reverts commit 0d086db.
  • Loading branch information
josephfusco committed Sep 11, 2024
1 parent 4569015 commit 795b738
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function App() {
Field( node ) {
if (
node.name.value === '__schema' ||
node.name.value === '__typename'
node.name.value === '__type'
) {
isIntrospectionQuery = true;
return visit.BREAK; // Early exit if introspection query is detected
Expand All @@ -71,22 +71,22 @@ export function App() {

const { graphqlEndpoint } = window.WPGRAPHQL_IDE_DATA;

const base64Credentials = btoa( `growth:growth` );

const headers = {
'Content-Type': 'application/json',
Authorization: `Basic ${ base64Credentials }`,
};

const credentials = isIntrospectionQuery
? 'include'
: isAuthenticated
? 'include'
: 'omit';

console.log({credentials});
const response = await fetch( graphqlEndpoint, {
method: 'POST',
headers,
body: JSON.stringify( graphQLParams ),
credentials: isIntrospectionQuery
? 'include'
: isAuthenticated
? 'include'
: 'omit',
credentials,
} );

return response.json();
Expand Down

0 comments on commit 795b738

Please sign in to comment.