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