project: organize apollo files
This commit is contained in:
parent
b8ddce6f09
commit
05980e1099
@ -1,5 +1,4 @@
|
||||
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
/** @type {import('@apollo/client').ApolloClient<NormalizedCacheObject>} */
|
||||
let apolloClient;
|
||||
@ -32,8 +31,3 @@ export function initializeApollo(initialState = null) {
|
||||
|
||||
return _apolloClient;
|
||||
}
|
||||
|
||||
export function useApollo(initialState) {
|
||||
const client = useMemo(() => initializeApollo(initialState), [initialState]);
|
||||
return client;
|
||||
}
|
||||
7
apollo/hooks.js
Normal file
7
apollo/hooks.js
Normal file
@ -0,0 +1,7 @@
|
||||
import { useMemo } from 'react';
|
||||
import { initializeApollo } from './client';
|
||||
|
||||
export function useApollo(initialState) {
|
||||
const client = useMemo(() => initializeApollo(initialState), [initialState]);
|
||||
return client;
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
import { ApolloProvider } from '@apollo/client';
|
||||
import 'antd/dist/antd.less';
|
||||
import { useApollo } from 'apollo/hooks';
|
||||
import Layout from 'Components/Layout';
|
||||
import type { AppProps } from 'next/app';
|
||||
import Head from 'next/head';
|
||||
import { useApollo } from 'services/crm/graphql/client';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
import { GlobalStyle } from 'UIKit/colors';
|
||||
import theme from 'UIKit/theme';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { NormalizedCacheObject } from '@apollo/client';
|
||||
import { initializeApollo } from 'apollo/client';
|
||||
import type { GetServerSideProps, NextPage } from 'next';
|
||||
import { initializeApollo } from 'services/crm/graphql/client';
|
||||
import { fetchUser } from 'services/user';
|
||||
import type { User } from 'services/user/types';
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user