From a4823fb907f88ceb71cddf81c6d3106b3d0fedaf Mon Sep 17 00:00:00 2001 From: VTeacher rgbkids Date: Sun, 8 Aug 2021 21:26:32 +0900 Subject: [PATCH 1/2] fix: JSON.parse fails in react-fetch --- server/api.server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/api.server.js b/server/api.server.js index 20dff98..6e33aa9 100644 --- a/server/api.server.js +++ b/server/api.server.js @@ -174,7 +174,7 @@ app.get( const {rows} = await pool.query('select * from notes where id = $1', [ req.params.id, ]); - res.json(rows[0]); + res.json(rows[0] || "null"); }) ); From bbcaf60ad890045fbe856c8e18115d7bd1a80c24 Mon Sep 17 00:00:00 2001 From: m-suzuki Date: Fri, 26 Nov 2021 13:37:25 +0900 Subject: [PATCH 2/2] fix: JSON.parse fails in react-fetch --- server/api.server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/api.server.js b/server/api.server.js index 6e33aa9..f3cab5a 100644 --- a/server/api.server.js +++ b/server/api.server.js @@ -174,7 +174,7 @@ app.get( const {rows} = await pool.query('select * from notes where id = $1', [ req.params.id, ]); - res.json(rows[0] || "null"); + res.json(rows[0] || null); }) );