fix apollo ssr client imports
This commit is contained in:
parent
ca1a95094c
commit
a226bac25d
|
@ -1,12 +1,13 @@
|
|||
import { ITEM_FIELDS } from '../../../fragments/items'
|
||||
import { gql } from '@apollo/client'
|
||||
import ApolloClient from '../../../api/client'
|
||||
import getSSRApolloClient from '../../../api/ssrApollo'
|
||||
import { DiscussionForm } from '../../../components/discussion-form'
|
||||
import { LinkForm } from '../../../components/link-form'
|
||||
import LayoutCenter from '../../../components/layout-center'
|
||||
|
||||
export async function getServerSideProps ({ req, params: { id } }) {
|
||||
const { error, data: { item } } = await (await ApolloClient(req)).query({
|
||||
const client = await getSSRApolloClient(req)
|
||||
const { error, data: { item } } = await client.query({
|
||||
query:
|
||||
gql`
|
||||
${ITEM_FIELDS}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
import ApolloClient from '../api/client'
|
||||
import getSSRApolloClient from '../api/ssrApollo'
|
||||
import generateRssFeed from '../lib/rss'
|
||||
import { MORE_ITEMS } from '../fragments/items'
|
||||
|
||||
|
@ -9,7 +9,8 @@ export default function RssFeed () {
|
|||
|
||||
export async function getServerSideProps ({ req, res }) {
|
||||
const emptyProps = { props: {} } // to avoid server side warnings
|
||||
const { error, data: { moreItems: { items } } } = await (await ApolloClient(req)).query({
|
||||
const client = await getSSRApolloClient(req)
|
||||
const { error, data: { moreItems: { items } } } = await client.query({
|
||||
query: MORE_ITEMS,
|
||||
variables: { sort: 'hot' }
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue