2021-04-14 00:57:32 +00:00
|
|
|
import '../styles/globals.scss'
|
2021-04-12 18:05:09 +00:00
|
|
|
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client'
|
|
|
|
import { Provider } from 'next-auth/client'
|
2021-05-20 21:32:59 +00:00
|
|
|
import { FundErrorModal, FundErrorProvider } from '../components/fund-error'
|
2021-05-25 00:08:56 +00:00
|
|
|
import { MeProvider } from '../components/me'
|
2021-04-12 18:05:09 +00:00
|
|
|
|
|
|
|
const client = new ApolloClient({
|
|
|
|
uri: '/api/graphql',
|
2021-06-22 17:47:49 +00:00
|
|
|
cache: new InMemoryCache({
|
|
|
|
typePolicies: {
|
|
|
|
Query: {
|
|
|
|
fields: {
|
|
|
|
moreItems: {
|
|
|
|
keyArgs: ['sort', 'userId'],
|
|
|
|
merge (existing, incoming, { readField }) {
|
|
|
|
const items = existing ? existing.items : []
|
|
|
|
return {
|
|
|
|
cursor: incoming.cursor,
|
|
|
|
items: [...items, ...incoming.items]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
read (existing) {
|
|
|
|
if (existing) {
|
|
|
|
return {
|
|
|
|
cursor: existing.cursor,
|
|
|
|
items: existing.items
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-24 23:56:01 +00:00
|
|
|
},
|
|
|
|
moreFlatComments: {
|
|
|
|
keyArgs: ['userId'],
|
|
|
|
merge (existing, incoming, { readField }) {
|
|
|
|
const comments = existing ? existing.comments : []
|
|
|
|
return {
|
|
|
|
cursor: incoming.cursor,
|
|
|
|
comments: [...comments, ...incoming.comments]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
read (existing) {
|
|
|
|
if (existing) {
|
|
|
|
return {
|
|
|
|
cursor: existing.cursor,
|
|
|
|
comments: existing.comments
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-22 17:47:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2021-04-12 18:05:09 +00:00
|
|
|
})
|
2021-03-22 20:36:10 +00:00
|
|
|
|
2021-03-25 19:29:24 +00:00
|
|
|
function MyApp ({ Component, pageProps }) {
|
2021-04-12 18:05:09 +00:00
|
|
|
return (
|
2021-06-17 18:24:35 +00:00
|
|
|
<>
|
|
|
|
<Provider session={pageProps.session}>
|
|
|
|
<ApolloProvider client={client}>
|
|
|
|
<MeProvider>
|
|
|
|
<FundErrorProvider>
|
|
|
|
<FundErrorModal />
|
|
|
|
<Component {...pageProps} />
|
|
|
|
</FundErrorProvider>
|
|
|
|
</MeProvider>
|
|
|
|
</ApolloProvider>
|
|
|
|
</Provider>
|
|
|
|
</>
|
2021-04-12 18:05:09 +00:00
|
|
|
)
|
2021-03-22 20:36:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default MyApp
|