From dc719120b252a53f96e6f258169834008edcb819 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 5 Mar 2024 18:20:47 +0300 Subject: [PATCH] debug-update-shout --- src/context/editor.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/context/editor.tsx b/src/context/editor.tsx index 40f21d2d..1fe675e1 100644 --- a/src/context/editor.tsx +++ b/src/context/editor.tsx @@ -127,6 +127,10 @@ export const EditorProvider = (props: { children: JSX.Element }) => { } const updateShout = async (formToUpdate: ShoutForm, { publish }: { publish: boolean }) => { + if (!formToUpdate.shoutId) { + console.error(formToUpdate) + return {"error": "not enought data"} + } return await apiClient.updateArticle({ shout_id: formToUpdate.shoutId, shout_input: { @@ -228,6 +232,10 @@ export const EditorProvider = (props: { children: JSX.Element }) => { } const publishShoutById = async (shout_id: number) => { + if (!shout_id) { + console.error(`shout_id is ${shout_id}`) + return + } try { const { shout: newShout, error } = await apiClient.updateArticle({ shout_id,