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