From c20061ab8be167b06b25ec30648858563f547363 Mon Sep 17 00:00:00 2001 From: stream Date: Mon, 30 Oct 2023 19:16:49 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=81=BF?= =?UTF-8?q?=E5=A4=B1=E6=95=97=E3=81=97=E3=81=9F=E3=82=89=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.jsx | 5 +++++ frontend/src/components/Timeline.jsx | 8 +++++++- scripts/setup.sh | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 0756621..253cb9f 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -9,6 +9,7 @@ import { ToggleTheme } from "./components/theme/ToggleTheme.jsx"; function App() { const [posts, setPosts] = useState([]); const [isLoading, setIsLoading] = useState(false); + const [LoadFailed, setLoadFailed] = useState(false); const onSubmitted = (post) => { setPosts([post, ...posts]); }; @@ -19,10 +20,13 @@ function App() { const data = await res.json(); if (!res.ok) { console.error(data); + setIsLoading(false); + setLoadFailed(true); return; } setPosts(data); setIsLoading(false); + setLoadFailed(false); }; useEffect(() => { @@ -52,6 +56,7 @@ function App() { posts={posts} isLoading={isLoading} fetchPosts={fetchPosts} + LoadFailed={LoadFailed} /> diff --git a/frontend/src/components/Timeline.jsx b/frontend/src/components/Timeline.jsx index 18d873b..617a1a5 100644 --- a/frontend/src/components/Timeline.jsx +++ b/frontend/src/components/Timeline.jsx @@ -5,7 +5,7 @@ const formatDateTime = (dateTimeString) => { return new Date(dateTimeString).toLocaleString("ja-JP", options); }; -export const Timeline = ({ posts, isLoading, fetchPosts }) => { +export const Timeline = ({ posts, isLoading, fetchPosts, LoadFailed}) => { return ( <> @@ -18,6 +18,12 @@ export const Timeline = ({ posts, isLoading, fetchPosts }) => { {isLoading ? "読み込み中" : "更新する"} + + {LoadFailed ? "読み込みに失敗しました": ""} + {posts.map((post) => ( diff --git a/scripts/setup.sh b/scripts/setup.sh index b5b2485..3a7dd9f 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -43,7 +43,7 @@ go mod tidy echo "バックエンドのセットアップが完了しました!" echo "Dockerのセットアップを開始します..." - +docker compose down docker compose build docker compose up -d From c4e5df49511aa426868f46de20ced304131e5651 Mon Sep 17 00:00:00 2001 From: stream Date: Mon, 6 Nov 2023 18:11:36 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E3=82=B3=E3=83=B3=E3=83=95=E3=83=AA?= =?UTF-8?q?=E3=82=AF=E3=83=88=E3=82=92=E8=A7=A3=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/setup.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 8abac0a..3a7dd9f 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -43,10 +43,6 @@ go mod tidy echo "バックエンドのセットアップが完了しました!" echo "Dockerのセットアップを開始します..." -<<<<<<< HEAD -======= - ->>>>>>> fe2d9dda3b2192048290e21c676424b4df3943bf docker compose down docker compose build docker compose up -d