stacker.news/pages/stackers/search.js

23 lines
755 B
JavaScript
Raw Normal View History

import { SearchLayout } from '@/components/layout'
import { getGetServerSideProps } from '@/api/ssrApollo'
import { USER_SEARCH } from '@/fragments/users'
import UserList from '@/components/user-list'
import { useRouter } from 'next/router'
2023-05-18 23:41:56 +00:00
const staticVariables = { limit: 21, similarity: 0.2 }
export const getServerSideProps = getGetServerSideProps({ query: USER_SEARCH, variables: staticVariables })
export default function Index ({ ssrData }) {
const router = useRouter()
const variables = { ...staticVariables, ...router.query }
2023-05-18 23:41:56 +00:00
return (
<SearchLayout>
<UserList
ssrData={ssrData} query={USER_SEARCH}
destructureData={data => ({ users: data.searchUsers })} variables={variables}
/>
</SearchLayout>
2023-05-18 23:41:56 +00:00
)
}