fix apollo ssr client imports

This commit is contained in:
keyan 2021-09-30 11:03:43 -05:00
parent ca1a95094c
commit a226bac25d
2 changed files with 6 additions and 4 deletions

View File

@ -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}

View File

@ -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' }
})