debug-update-shout

This commit is contained in:
Untone 2024-03-05 18:20:47 +03:00
parent 2d7fd38d82
commit dc719120b2

View File

@ -127,6 +127,10 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
} }
const updateShout = async (formToUpdate: ShoutForm, { publish }: { publish: boolean }) => { const updateShout = async (formToUpdate: ShoutForm, { publish }: { publish: boolean }) => {
if (!formToUpdate.shoutId) {
console.error(formToUpdate)
return {"error": "not enought data"}
}
return await apiClient.updateArticle({ return await apiClient.updateArticle({
shout_id: formToUpdate.shoutId, shout_id: formToUpdate.shoutId,
shout_input: { shout_input: {
@ -228,6 +232,10 @@ export const EditorProvider = (props: { children: JSX.Element }) => {
} }
const publishShoutById = async (shout_id: number) => { const publishShoutById = async (shout_id: number) => {
if (!shout_id) {
console.error(`shout_id is ${shout_id}`)
return
}
try { try {
const { shout: newShout, error } = await apiClient.updateArticle({ const { shout: newShout, error } = await apiClient.updateArticle({
shout_id, shout_id,