From 79f76904a50ba545a5df33dee43ff3a5bcd2af37 Mon Sep 17 00:00:00 2001 From: sirpiglr <49359077-sirpiglr@users.noreply.replit.com> Date: Wed, 3 Dec 2025 19:14:12 +0000 Subject: [PATCH] Fix incorrect API endpoint for creating posts Corrected the API endpoint from `/api/community/posts` to `/api/posts` in `client/components/feed/PostComposer.tsx` and `client/pages/AdminFeed.tsx` to resolve 404 errors during post creation. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9203795e-937a-4306-b81d-b4d5c78c240e Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: a799a8f1-584a-45ee-89c7-1f58a69e6795 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7c94b7a0-29c7-4f2e-94ef-44b2153872b7/9203795e-937a-4306-b81d-b4d5c78c240e/zMxtXds Replit-Helium-Checkpoint-Created: true --- ...sponse-Une-1764789192494_1764789192496.txt | 74 +++++++++++++++++++ client/components/feed/PostComposer.tsx | 2 +- client/pages/AdminFeed.tsx | 2 +- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 attached_assets/Pasted-PostComposer-tsx-231-Error-submitting-post-SyntaxError-Failed-to-execute-json-on-Response-Une-1764789192494_1764789192496.txt diff --git a/attached_assets/Pasted-PostComposer-tsx-231-Error-submitting-post-SyntaxError-Failed-to-execute-json-on-Response-Une-1764789192494_1764789192496.txt b/attached_assets/Pasted-PostComposer-tsx-231-Error-submitting-post-SyntaxError-Failed-to-execute-json-on-Response-Une-1764789192494_1764789192496.txt new file mode 100644 index 00000000..c2cab3c1 --- /dev/null +++ b/attached_assets/Pasted-PostComposer-tsx-231-Error-submitting-post-SyntaxError-Failed-to-execute-json-on-Response-Une-1764789192494_1764789192496.txt @@ -0,0 +1,74 @@ +PostComposer.tsx:231 Error submitting post: SyntaxError: Failed to execute 'json' on 'Response': Unexpected end of JSON input + at handleSubmit (PostComposer.tsx:222:38) +handleSubmit @ PostComposer.tsx:231 +await in handleSubmit +callCallback2 @ chunk-FLMU7I4S.js?v=57e95f4a:3680 +invokeGuardedCallbackDev @ chunk-FLMU7I4S.js?v=57e95f4a:3705 +invokeGuardedCallback @ chunk-FLMU7I4S.js?v=57e95f4a:3739 +invokeGuardedCallbackAndCatchFirstError @ chunk-FLMU7I4S.js?v=57e95f4a:3742 +executeDispatch @ chunk-FLMU7I4S.js?v=57e95f4a:7046 +processDispatchQueueItemsInOrder @ chunk-FLMU7I4S.js?v=57e95f4a:7066 +processDispatchQueue @ chunk-FLMU7I4S.js?v=57e95f4a:7075 +dispatchEventsForPlugins @ chunk-FLMU7I4S.js?v=57e95f4a:7083 +(anonymous) @ chunk-FLMU7I4S.js?v=57e95f4a:7206 +batchedUpdates$1 @ chunk-FLMU7I4S.js?v=57e95f4a:18966 +batchedUpdates @ chunk-FLMU7I4S.js?v=57e95f4a:3585 +dispatchEventForPluginEventSystem @ chunk-FLMU7I4S.js?v=57e95f4a:7205 +dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ chunk-FLMU7I4S.js?v=57e95f4a:5484 +dispatchEvent @ chunk-FLMU7I4S.js?v=57e95f4a:5478 +dispatchDiscreteEvent @ chunk-FLMU7I4S.js?v=57e95f4a:5455 +PostComposer.tsx:175 POST https://7c94b7a0-29c7-4f2e-94ef-44b2153872b7-00-2x189rywzk1ng.kirk.replit.dev/api/community/posts 404 (Not Found) +handleSubmit @ PostComposer.tsx:175 +callCallback2 @ chunk-FLMU7I4S.js?v=57e95f4a:3680 +invokeGuardedCallbackDev @ chunk-FLMU7I4S.js?v=57e95f4a:3705 +invokeGuardedCallback @ chunk-FLMU7I4S.js?v=57e95f4a:3739 +invokeGuardedCallbackAndCatchFirstError @ chunk-FLMU7I4S.js?v=57e95f4a:3742 +executeDispatch @ chunk-FLMU7I4S.js?v=57e95f4a:7046 +processDispatchQueueItemsInOrder @ chunk-FLMU7I4S.js?v=57e95f4a:7066 +processDispatchQueue @ chunk-FLMU7I4S.js?v=57e95f4a:7075 +dispatchEventsForPlugins @ chunk-FLMU7I4S.js?v=57e95f4a:7083 +(anonymous) @ chunk-FLMU7I4S.js?v=57e95f4a:7206 +batchedUpdates$1 @ chunk-FLMU7I4S.js?v=57e95f4a:18966 +batchedUpdates @ chunk-FLMU7I4S.js?v=57e95f4a:3585 +dispatchEventForPluginEventSystem @ chunk-FLMU7I4S.js?v=57e95f4a:7205 +dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ chunk-FLMU7I4S.js?v=57e95f4a:5484 +dispatchEvent @ chunk-FLMU7I4S.js?v=57e95f4a:5478 +dispatchDiscreteEvent @ chunk-FLMU7I4S.js?v=57e95f4a:5455 +PostComposer.tsx:231 Error submitting post: SyntaxError: Failed to execute 'json' on 'Response': Unexpected end of JSON input + at handleSubmit (PostComposer.tsx:222:38) +handleSubmit @ PostComposer.tsx:231 +await in handleSubmit +callCallback2 @ chunk-FLMU7I4S.js?v=57e95f4a:3680 +invokeGuardedCallbackDev @ chunk-FLMU7I4S.js?v=57e95f4a:3705 +invokeGuardedCallback @ chunk-FLMU7I4S.js?v=57e95f4a:3739 +invokeGuardedCallbackAndCatchFirstError @ chunk-FLMU7I4S.js?v=57e95f4a:3742 +executeDispatch @ chunk-FLMU7I4S.js?v=57e95f4a:7046 +processDispatchQueueItemsInOrder @ chunk-FLMU7I4S.js?v=57e95f4a:7066 +processDispatchQueue @ chunk-FLMU7I4S.js?v=57e95f4a:7075 +dispatchEventsForPlugins @ chunk-FLMU7I4S.js?v=57e95f4a:7083 +(anonymous) @ chunk-FLMU7I4S.js?v=57e95f4a:7206 +batchedUpdates$1 @ chunk-FLMU7I4S.js?v=57e95f4a:18966 +batchedUpdates @ chunk-FLMU7I4S.js?v=57e95f4a:3585 +dispatchEventForPluginEventSystem @ chunk-FLMU7I4S.js?v=57e95f4a:7205 +dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ chunk-FLMU7I4S.js?v=57e95f4a:5484 +dispatchEvent @ chunk-FLMU7I4S.js?v=57e95f4a:5478 +dispatchDiscreteEvent @ chunk-FLMU7I4S.js?v=57e95f4a:5455 +PostComposer.tsx:175 POST https://7c94b7a0-29c7-4f2e-94ef-44b2153872b7-00-2x189rywzk1ng.kirk.replit.dev/api/community/posts 404 (Not Found) +handleSubmit @ PostComposer.tsx:175 +callCallback2 @ chunk-FLMU7I4S.js?v=57e95f4a:3680 +invokeGuardedCallbackDev @ chunk-FLMU7I4S.js?v=57e95f4a:3705 +invokeGuardedCallback @ chunk-FLMU7I4S.js?v=57e95f4a:3739 +invokeGuardedCallbackAndCatchFirstError @ chunk-FLMU7I4S.js?v=57e95f4a:3742 +executeDispatch @ chunk-FLMU7I4S.js?v=57e95f4a:7046 +processDispatchQueueItemsInOrder @ chunk-FLMU7I4S.js?v=57e95f4a:7066 +processDispatchQueue @ chunk-FLMU7I4S.js?v=57e95f4a:7075 +dispatchEventsForPlugins @ chunk-FLMU7I4S.js?v=57e95f4a:7083 +(anonymous) @ chunk-FLMU7I4S.js?v=57e95f4a:7206 +batchedUpdates$1 @ chunk-FLMU7I4S.js?v=57e95f4a:18966 +batchedUpdates @ chunk-FLMU7I4S.js?v=57e95f4a:3585 +dispatchEventForPluginEventSystem @ chunk-FLMU7I4S.js?v=57e95f4a:7205 +dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ chunk-FLMU7I4S.js?v=57e95f4a:5484 +dispatchEvent @ chunk-FLMU7I4S.js?v=57e95f4a:5478 +dispatchDiscreteEvent @ chunk-FLMU7I4S.js?v=57e95f4a:5455 +PostComposer.tsx:231 Error submitting post: SyntaxError: Failed to execute 'json' on 'Response': Unexpected end of JSON input + at handleSubmit (PostComposer.tsx:222:38) \ No newline at end of file diff --git a/client/components/feed/PostComposer.tsx b/client/components/feed/PostComposer.tsx index 982ed0f8..11faa3d3 100644 --- a/client/components/feed/PostComposer.tsx +++ b/client/components/feed/PostComposer.tsx @@ -158,7 +158,7 @@ export default function PostComposer({ setIsSubmitting(true); try { - const url = `${API_BASE}/api/community/posts`; + const url = `${API_BASE}/api/posts`; const method = editingPost ? "PUT" : "POST"; const payload = { diff --git a/client/pages/AdminFeed.tsx b/client/pages/AdminFeed.tsx index bb3c3609..f0660df0 100644 --- a/client/pages/AdminFeed.tsx +++ b/client/pages/AdminFeed.tsx @@ -92,7 +92,7 @@ export default function AdminFeed() { setIsLoading(true); try { - const response = await fetch("/api/community/posts", { + const response = await fetch("/api/posts", { method: "POST", headers: { "Content-Type": "application/json",