import { useEffect, useState } from 'react' import { Link, useLocation, useParams } from 'react-router-dom' import MainArea from '@/components/layout/MainArea' import axios from 'axios' import { API_BASE_URL } from '@/config' 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 (axios.get (`${ API_BASE_URL }/wiki/changes`, id && { params: { id } }) .then (res => setChanges (res.data))) }, [location.search]) return ( {changes.map (change => ( ))}
タイトル 変更 日時
{change.change_type === 'update' && ( 差分 )} {change.wiki_page.title} {(() => { switch (change.change_type) { case 'create': return '新規' case 'update': return '更新' case 'delete': return '削除' } }) ()} {change.user.name}
{change.timestamp}
) }