diff --git a/api/search.js b/api/search.js index 7e16cce..229619b 100644 --- a/api/search.js +++ b/api/search.js @@ -3,13 +3,11 @@ import apiRequest from './index' const FileDownload = require('js-file-download') export const fetchWorks = async (body) => { - // eslint-disable-next-line camelcase - const { search_id } = body - const split = search_id?.split('-') + const { t } = body + const split = t?.split('-') const isUndefined = split?.some((item) => item === undefined) const url = new URL( - // eslint-disable-next-line camelcase - `/v3/search/works${!isUndefined || search_id ? `?t=${search_id}` : ''}`, + `/v3/search/works${!isUndefined || t ? `?t=${t}` : ''}`, process.env.API_URL ).href const { data: dataWorks } = await apiRequest(url, { diff --git a/pages/search/index.jsx b/pages/search/index.jsx index 3172f67..53906fd 100644 --- a/pages/search/index.jsx +++ b/pages/search/index.jsx @@ -40,12 +40,10 @@ export const getServerSideProps = async ({ query: searchParams }) => { q, offset, limit, + t, exclude: ['fullText'], sort: sort === 'recent' ? 'recency' : sort, } - - if (t) body.t = t - try { const response = await fetchWorks(body)