I’m very new to react/node. I tried to use what you provided with the shopify CLI boilerplate app and it doesn’t seem to work. Can you tell me what I’ve done wrong? Thanks!
function MyProvider(props) {
const app = useAppBridge();
// Create axios instance for authenticated request
const authAxios = axios.create();
// intercept all requests on this axios instance
authAxios.interceptors.request.use(function (config) {
return getSessionToken(app)
.then((token) => {
// append your request headers with an authenticated token
config.headers["Authorization"] = `Bearer ${token}`;
return config;
});
});
const client = new ApolloClient({
fetch: authenticatedFetch(app),
fetchOptions: {
credentials: "include",
},
});
const Component = props.Component;
return (
);
}