Browse Source

Merge branch 'main' into feature/190

pull/191/head
みてるぞ 1 week ago
parent
commit
f895479e3e
2 changed files with 13 additions and 3 deletions
  1. +1
    -0
      backend/app/models/nico_tag_relation.rb
  2. +12
    -3
      frontend/src/pages/wiki/WikiDetailPage.tsx

+ 1
- 0
backend/app/models/nico_tag_relation.rb View File

@@ -6,6 +6,7 @@ class NicoTagRelation < ApplicationRecord
validates :tag_id, presence: true

validate :nico_tag_must_be_nico
validate :tag_mustnt_be_nico

private



+ 12
- 3
frontend/src/pages/wiki/WikiDetailPage.tsx View File

@@ -36,9 +36,16 @@ export default () => {
if (/^\d+$/.test (title))
{
void (async () => {
const res = await axios.get (`${ API_BASE_URL }/wiki/${ title }`)
const data = res.data as WikiPage
navigate (`/wiki/${ data.title }`, { replace: true })
try
{
const res = await axios.get (`${ API_BASE_URL }/wiki/${ title }`)
const data = res.data as WikiPage
navigate (`/wiki/${ encodeURIComponent(data.title) }`, { replace: true })
}
catch
{
;
}
}) ()

return
@@ -51,6 +58,8 @@ export default () => {
`${ API_BASE_URL }/wiki/title/${ encodeURIComponent (title) }`,
{ params: version ? { version } : { } })
const data = toCamel (res.data as any, { deep: true }) as WikiPage
if (data.title !== title)
navigate (`/wiki/${ encodeURIComponent(data.title) }`, { replace: true })
setWikiPage (data)
WikiIdBus.set (data.id)
}


Loading…
Cancel
Save