fix: use cache-and-network fetchPolicy for consistency

This commit is contained in:
Ali BARIN
2022-08-02 20:31:39 +02:00
parent 744c927b69
commit ae8f701e5c
2 changed files with 7 additions and 2 deletions

View File

@@ -10,7 +10,12 @@ type CreateClientOptions = {
const client = new ApolloClient({
cache,
link: createLink({ uri: appConfig.graphqlUrl })
link: createLink({ uri: appConfig.graphqlUrl }),
defaultOptions: {
watchQuery: {
fetchPolicy: 'cache-and-network',
}
}
});
export function mutateAndGetClient(options: CreateClientOptions): typeof client {

View File

@@ -4,7 +4,7 @@ import { IUser } from '@automatisch/types';
import { GET_CURRENT_USER } from 'graphql/queries/get-current-user';
export default function useCurrentUser(): IUser {
const { data } = useQuery(GET_CURRENT_USER, { fetchPolicy: 'cache-and-network' });
const { data } = useQuery(GET_CURRENT_USER);
return data?.getCurrentUser;
}