diff --git a/frontend/src/pages/posts/PostListPage.tsx b/frontend/src/pages/posts/PostListPage.tsx index 13a6256..4739775 100644 --- a/frontend/src/pages/posts/PostListPage.tsx +++ b/frontend/src/pages/posts/PostListPage.tsx @@ -20,25 +20,27 @@ export default () => { const location = useLocation () const query = new URLSearchParams (location.search) const tagsQuery = query.get ('tags') ?? '' - // const anyFlg = query.get ('match') === 'any' - const anyFlg = false + const anyFlg = query.get ('match') === 'any' const tags = tagsQuery.split (' ').filter (e => e !== '') useEffect(() => { void (axios.get (`${ API_BASE_URL }/posts`, { params: { tags: tags.join (','), match: (anyFlg ? 'any' : 'all') } }) - .then (res => setPosts (res.data)) + .then (res => setPosts (toCamel (res.data, { deep: true }))) .catch (err => { console.error ('Failed to fetch posts:', err) setPosts ([]) })) + setWikiPage (null) if (!(tags.length)) return void (axios.get (`${ API_BASE_URL }/wiki/title/${ encodeURIComponent (tags.join (' ')) }`) .then (res => setWikiPage (toCamel (res.data, { deep: true }))) - .catch (() => setWikiPage (null))) + .catch (() => { + ; + })) }, [location.search]) return ( @@ -58,13 +60,12 @@ export default () => { ? (
{posts.map (post => ( - - - - ))} + + + ))}
) : '広場には何もありませんよ.'} diff --git a/frontend/src/types.ts b/frontend/src/types.ts index f937943..933155e 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -3,12 +3,13 @@ import { CATEGORIES, USER_ROLES } from '@/consts' export type Category = typeof CATEGORIES[number] export type Post = { - id: number - url: string - title: string - thumbnail: string - tags: Tag[] - viewed: boolean } + id: number + url: string + title: string + thumbnail: string + thumbnailBase: string + tags: Tag[] + viewed: boolean } export type Tag = { id: number