diff --git a/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap b/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap index 1b3428cfe5..e9eb130057 100644 --- a/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap +++ b/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap @@ -4,7 +4,6 @@ exports[`returns a map with expected keys and values 1`] = ` Map { "MUTATION_QUEUE" => "mutationQueue", "RETRY" => "retry", - "AUTH" => "auth", "GQL_CACHE" => "gqlCache", "STORE" => "store", "ERROR" => "error", diff --git a/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js b/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js index 7185d08491..a538dfd4e0 100644 --- a/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js +++ b/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js @@ -7,10 +7,10 @@ jest.mock('@apollo/client', () => ({ __esModule: true, createHttpLink: jest.fn(() => 'http') })); -jest.mock('@magento/peregrine/lib/Apollo/links/authLink', () => ({ - __esModule: true, - default: jest.fn(() => 'auth') -})); +// jest.mock('@magento/peregrine/lib/Apollo/links/authLink', () => ({ +// __esModule: true, +// default: jest.fn(() => 'auth') +// })); jest.mock('@magento/peregrine/lib/Apollo/links/errorLink', () => ({ __esModule: true, default: jest.fn(() => 'error') diff --git a/packages/peregrine/lib/Apollo/links/authLink.js b/packages/peregrine/lib/Apollo/links/authLink.js index bb6be29d93..c5efd6eaf6 100644 --- a/packages/peregrine/lib/Apollo/links/authLink.js +++ b/packages/peregrine/lib/Apollo/links/authLink.js @@ -1,18 +1,18 @@ import { setContext } from '@apollo/client/link/context'; -import { BrowserPersistence } from '@magento/peregrine/lib/util'; +// import { BrowserPersistence } from '@magento/peregrine/lib/util'; -const storage = new BrowserPersistence(); +// const storage = new BrowserPersistence(); export default function createAuthLink() { return setContext((_, { headers }) => { // get the authentication token from local storage if it exists. - const token = storage.getItem('signin_token'); + // const token = storage.getItem('signin_token'); // return the headers to the context so httpLink can read them return { headers: { - ...headers, - authorization: token ? `Bearer ${token}` : '' + ...headers + // authorization: token ? `Bearer ${token}` : '' } }; }); diff --git a/packages/peregrine/lib/Apollo/links/index.js b/packages/peregrine/lib/Apollo/links/index.js index 1a6bf48b1e..5d867985c8 100644 --- a/packages/peregrine/lib/Apollo/links/index.js +++ b/packages/peregrine/lib/Apollo/links/index.js @@ -1,6 +1,6 @@ import { createHttpLink } from '@apollo/client'; -import createAuthLink from '@magento/peregrine/lib/Apollo/links/authLink'; +// import createAuthLink from '@magento/peregrine/lib/Apollo/links/authLink'; import createErrorLink from '@magento/peregrine/lib/Apollo/links/errorLink'; import createGqlCacheLink from '@magento/peregrine/lib/Apollo/links/gqlCacheLink'; import createMutationQueueLink from '@magento/peregrine/lib/Apollo/links/mutationQueueLink'; @@ -32,7 +32,7 @@ export const customFetchToShrinkQuery = (uri, options) => { }; const getLinks = apiBase => { - const authLink = createAuthLink(); + // const authLink = createAuthLink(); const storeLink = createStoreLink(); const errorLink = createErrorLink(); const retryLink = createRetryLink(); @@ -54,7 +54,7 @@ const getLinks = apiBase => { const links = new Map() .set('MUTATION_QUEUE', mutationQueueLink) .set('RETRY', retryLink) - .set('AUTH', authLink) + // .set('AUTH', authLink) .set('GQL_CACHE', gqlCacheLink) .set('STORE', storeLink) .set('ERROR', errorLink)