diff --git a/ui/src/views/journal/Editor.tsx b/ui/src/views/journal/Editor.tsx index 2e2c9db4..e2ad6261 100644 --- a/ui/src/views/journal/Editor.tsx +++ b/ui/src/views/journal/Editor.tsx @@ -69,6 +69,7 @@ type Action = | { type: "set_content"; content: string } | { type: "set_time"; time: Date | undefined } | { type: "save" } + | { type: "save_error" } | { type: "set_media_detail"; detail: MediaDetail } | { type: "set_autofill_details"; detail: AutofillDetail }; type Dispatch = (action: Action) => void; @@ -109,6 +110,9 @@ function Editor() { // reset the form values dispatch({ type: "clear" }); }, + onError() { + dispatch({ type: "save_error" }); + }, refetchQueries: [{ query: GetJournalMessages, variables: { journalId: journalId } }], }); @@ -117,6 +121,9 @@ function Editor() { // reset the form values dispatch({ type: "clear" }); }, + onError() { + dispatch({ type: "save_error" }); + }, refetchQueries: [{ query: GetJournalMessages, variables: { journalId: journalId } }], }); @@ -125,6 +132,9 @@ function Editor() { case "save": { return Object.assign({}, state, { saving: true }); } + case "save_error": { + return Object.assign({}, state, { saving: false }); + } case "set_sender": { return Object.assign({}, state, { sender: action.sender }); } diff --git a/ui/src/views/journal/EditorForms/Elements.tsx b/ui/src/views/journal/EditorForms/Elements.tsx index 9f98a9a6..a0da51c1 100644 --- a/ui/src/views/journal/EditorForms/Elements.tsx +++ b/ui/src/views/journal/EditorForms/Elements.tsx @@ -164,7 +164,7 @@ const RadioChannelDetailInput = () => { }; const SaveButton = () => { - const { dispatch } = useEditorContext(); + const { state, dispatch } = useEditorContext(); return (