import { useEffect, useState } from 'react' import { Helmet } from 'react-helmet-async' import { useLocation } from 'react-router-dom' import PrefetchLink from '@/components/PrefetchLink' import PageTitle from '@/components/common/PageTitle' import MainArea from '@/components/layout/MainArea' import { SITE_TITLE } from '@/config' import { apiGet } from '@/lib/api' import type { WikiPageChange } from '@/types' export default () => { const [changes, setChanges] = useState ([]) const location = useLocation () const query = new URLSearchParams (location.search) const id = query.get ('id') useEffect (() => { void (async () => { setChanges (await apiGet ('/wiki/changes', { params: id ? { id } : { } })) }) () }, [location.search]) return ( {`Wiki 変更履歴 | ${ SITE_TITLE }`} Wiki 履歴 {changes.map (change => ( ))}
タイトル 変更 日時
{change.pred != null && ( 差分 )} {change.wikiPage.title} {change.pred == null ? '新規' : '更新'} {change.user.name}
{change.timestamp}
) }