Skip to content

Commit

Permalink
CORE: fix id
Browse files Browse the repository at this point in the history
  • Loading branch information
ekachxaidze98 committed Nov 14, 2024
1 parent 3e08585 commit a7bdba3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 3 additions & 5 deletions api/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
4 changes: 1 addition & 3 deletions pages/search/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit a7bdba3

Please sign in to comment.