From a95b278599d4a910619b07803eede8b3e935bad7 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Thu, 26 Jun 2025 21:37:12 +0900 Subject: [PATCH] =?UTF-8?q?#56=20=E3=82=AA=E3=83=96=E3=82=BC=E3=82=AF?= =?UTF-8?q?=E3=83=88=E3=81=AE=E5=A4=89=E6=9B=B4=E3=81=8C=E8=A1=8C=E3=81=AF?= =?UTF-8?q?=E3=82=8C=E3=81=A6=E3=82=90=E3=81=AA=E3=81=83=E3=81=93=E3=81=A8?= =?UTF-8?q?=E3=81=A7=E6=8D=95=E6=8D=89=E3=81=A7=E3=81=8D=E3=81=A6=E3=82=90?= =?UTF-8?q?=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/PostDetailPage.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/PostDetailPage.tsx b/frontend/src/pages/PostDetailPage.tsx index 062fa1e..22d9d49 100644 --- a/frontend/src/pages/PostDetailPage.tsx +++ b/frontend/src/pages/PostDetailPage.tsx @@ -31,10 +31,7 @@ export default ({ user }: Props) => { void (axios.delete ( `${ API_BASE_URL }/posts/${ id }/viewed`, { headers: { 'X-Transfer-Code': localStorage.getItem ('user_code') || '' } }) - .then (res => setPost (post => { - post.viewed = false - return post - })) + .then (res => setPost (post => ({ ...post, viewed: false }))) .catch (err => toast ({ title: '失敗……', description: '通信に失敗しました……' }))) } @@ -44,10 +41,7 @@ export default ({ user }: Props) => { `${ API_BASE_URL }/posts/${ id }/viewed`, { }, { headers: { 'X-Transfer-Code': localStorage.getItem ('user_code') || '' } }) - .then (res => setPost (post => { - post.viewed = true - return post - })) + .then (res => setPost (post => ({ ...post, viewed: true }))) .catch (err => toast ({ title: '失敗……', description: '通信に失敗しました……' }))) }