This commit is contained in:
2025-06-28 15:46:38 +09:00
parent 3199c476a3
commit 934225f9e8
7 changed files with 115 additions and 36 deletions
+7 -6
View File
@@ -1,4 +1,5 @@
import axios from 'axios'
import toCamel from 'camelcase-keys'
import { useEffect, useState } from 'react'
import { Helmet } from 'react-helmet'
import { Link, useLocation, useParams } from 'react-router-dom'
@@ -18,7 +19,7 @@ export default () => {
useEffect (() => {
void (axios.get (`${ API_BASE_URL }/wiki/changes`, id && { params: { id } })
.then (res => setChanges (res.data)))
.then (res => setChanges (toCamel (res.data, { deep: true }))))
}, [location.search])
return (
@@ -39,19 +40,19 @@ export default () => {
{changes.map (change => (
<tr key={change.sha}>
<td>
{change.change_type === 'update' && (
<Link to={`/wiki/${ change.wiki_page.id }/diff?from=${ change.pred }&to=${ change.sha }`}>
{change.changeType === 'update' && (
<Link to={`/wiki/${ change.wikiPage.id }/diff?from=${ change.pred }&to=${ change.sha }`}>
</Link>)}
</td>
<td className="p-2">
<Link to={`/wiki/${ encodeURIComponent (change.wiki_page.title) }?version=${ change.sha }`}>
{change.wiki_page.title}
<Link to={`/wiki/${ encodeURIComponent (change.wikiPage.title) }?version=${ change.sha }`}>
{change.wikiPage.title}
</Link>
</td>
<td className="p-2">
{(() => {
switch (change.change_type)
switch (change.changeType)
{
case 'create':
return '新規'