a little cleanup on new rss feeds
This commit is contained in:
parent
b59f277a3b
commit
5e6e6a18e6
@ -49,11 +49,11 @@ function generateRssFeed (items) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function getGetRssServerSideProps (query, variables = null) {
|
export default function getGetRssServerSideProps (query, variables = null) {
|
||||||
return async function ({ req, res }) {
|
return async function ({ req, res, params }) {
|
||||||
const emptyProps = { props: {} } // to avoid server side warnings
|
const emptyProps = { props: {} } // to avoid server side warnings
|
||||||
const client = await getSSRApolloClient(req)
|
const client = await getSSRApolloClient(req)
|
||||||
const { error, data: { items: { items } } } = await client.query({
|
const { error, data: { items: { items } } } = await client.query({
|
||||||
query, variables
|
query, variables: { ...params, ...variables }
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!items || error) return emptyProps
|
if (!items || error) return emptyProps
|
||||||
|
@ -6,4 +6,4 @@ export default function RssFeed () {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getServerSideProps = getGetRssServerSideProps(ITEMS);
|
export const getServerSideProps = getGetRssServerSideProps(ITEMS)
|
||||||
|
@ -6,4 +6,4 @@ export default function RssFeed () {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getServerSideProps = ({ req, res, params }) => getGetRssServerSideProps(ITEMS, { sub: params.sub })({ req, res });
|
export const getServerSideProps = getGetRssServerSideProps(ITEMS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user