Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE: fix id #361

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading