import axios from 'axios' import toCamel from 'camelcase-keys' import { useEffect, useState } from 'react' import { Helmet } from 'react-helmet-async' import { Link, useLocation } from 'react-router-dom' import MainArea from '@/components/layout/MainArea' import { API_BASE_URL, SITE_TITLE } 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 (async () => { const res = await axios.get (`${ API_BASE_URL }/wiki/changes`, { params: { ...(id ? { id } : { }) } }) setChanges (toCamel (res.data as any, { deep: true }) as WikiPageChange[]) }) () }, [location.search]) return ( {`Wiki 変更履歴 | ${ SITE_TITLE }`} {changes.map (change => ( ))}
タイトル 変更 日時
{change.pred != null && ( 差分 )} {change.wikiPage.title} {change.pred == null ? '新規' : '更新'} {change.user.name}
{change.timestamp}
) }