このコミットが含まれているのは:
+4
-18
@@ -1,5 +1,4 @@
|
||||
import { apiDelete, apiGet, apiPost, apiPut } from '@/lib/api'
|
||||
import { queryRecordParams, setQueryRecords } from '@/lib/queryState'
|
||||
import { switchLocalePath } from '@/lib/locales'
|
||||
|
||||
import type { LocaleCode } from '@/lib/locales'
|
||||
@@ -8,7 +7,7 @@ import type { FetchPostsParams, Post, PostVersion } from '@/types'
|
||||
|
||||
|
||||
export const fetchPosts = async (
|
||||
{ url, title, tags, tagReferences, match, createdFrom, createdTo, updatedFrom, updatedTo,
|
||||
{ url, title, tags, match, createdFrom, createdTo, updatedFrom, updatedTo,
|
||||
originalCreatedFrom, originalCreatedTo, page, limit, order }: FetchPostsParams,
|
||||
locale: LocaleCode = 'ja',
|
||||
): Promise<{
|
||||
@@ -18,7 +17,6 @@ export const fetchPosts = async (
|
||||
...(url && { url }),
|
||||
...(title && { title }),
|
||||
...(tags && { tags }),
|
||||
...(tagReferences && queryRecordParams (new URLSearchParams (tagReferences), 'tag_refs')),
|
||||
...(match && { match }),
|
||||
...(createdFrom && { created_from: createdFrom }),
|
||||
...(createdTo && { created_to: createdTo }),
|
||||
@@ -39,21 +37,9 @@ export const switchPostFilterLocale = async (
|
||||
if (tags == null || tags.trim () === '')
|
||||
return switchLocalePath (location, targetLocale)
|
||||
|
||||
const { references } = await apiGet<{ references: {
|
||||
name: string
|
||||
tagId?: number
|
||||
externalTagId?: number
|
||||
negative?: boolean
|
||||
missing?: boolean }[] }> ('/posts/tag_filters', {
|
||||
locale, params: { tags, target_locale: targetLocale,
|
||||
...queryRecordParams (query, 'tag_refs') } })
|
||||
query.set ('tags', references.map (reference => reference.name).join (' '))
|
||||
setQueryRecords (query, 'tag_refs', references.map (reference => ({
|
||||
name: reference.name,
|
||||
negative: reference.negative,
|
||||
...(reference.tagId != null && { tag_id: reference.tagId }),
|
||||
...(reference.externalTagId != null && { external_tag_id: reference.externalTagId }),
|
||||
...(reference.missing && { missing: true }) })))
|
||||
const result = await apiGet<{ tags: string }> ('/posts/tag_filters', {
|
||||
locale, params: { tags, target_locale: targetLocale } })
|
||||
query.set ('tags', result.tags)
|
||||
return switchLocalePath ({ ...location, search: `?${query}` }, targetLocale)
|
||||
}
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする