I am using "@apollo/client": "^3.7.10"
The data is visible in the network tab but can’t able to access it in the application.
Query:
const CREATED_BY =
fragment CreatedBy on Person {
name
jobTitle
url
}
;
const REVIEWED_BY =
fragment ReviewedBy on Person {
name
jobTitle
url
}
;
const getArticleQuery = (article: IArticleIdentifier) => ({
document:
${CREATED_BY}
${REVIEWED_BY}
query ArticleContentQuery($id: String!) {
${article.type}(where: { id: $id }) {
text(urlKind: identifier)
lastReviewed
nextReviewed
printableCopy
headline
version
introduction
creator {
...CreatedBy
}
reviewedBy {
...ReviewedBy
}
audience {
audienceType
}
identifier(name: "MedicalAuthors") {
value
}
}
}`,
variables: { id: article.id },
});
This is apollo client object
const cache = new InMemoryCache({
addTypename: false,
possibleTypes: {
Person: ["Person"],
},
typePolicies: {
Query: {
fields: {
search: {
keyArgs: ["term", "audienceType", "type"],
// eslint-disable-next-line @typescript-eslint/default-param-last
merge(existing = { results: [] }, incoming) {
return { ...incoming, results: existing.results.concat(incoming.results) };
},
},
},
},
},
});
const useApolloClient = (accessToken?: string): ApolloClient<any> => {
return new ApolloClient({
link: authMiddleware(accessToken).concat(httpLink),
cache,
});
};