Hi there,
i have a GraphQL API for my Backend. Now i want to create some sample data when the user logged in for the first time. I tried the Auth0 Actions PostSignup because i thought this is the best way. Unfortunately i cant get the Apollo Client to work, thats my current code:
exports.onExecutePostUserRegistration = async (event, api) => {
var fetch = require('cross-fetch');
var _client = require('@apollo/client');
var gql = require('@apollo/client');
const client = new _client.ApolloClient({
uri: new _client.HttpLink({ uri: 'https://api.***.de', fetch }),
cache: new _client.InMemoryCache(),
});
client
.query({
query: gql`
query Todos {
getTodos {
createdAt
description
id
isCompleted
title
userID
}
}
`,
})
.then((result) => console.log(result));
};`Preformatted text`
I get this error: "\n"fetch" has not been found globally and no fetcher has been configured.
Do you have any idea whats wrong here ? Or do you even know a way i could implement this maybe in my own project ? I use NextJS.
Thanks!