Skip to content

Commit

Permalink
Fix save button in blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
ubbn committed May 12, 2024
1 parent ab25396 commit a9c3f81
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions frontend/src/components/blog/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useParams } from "react-router-dom";
import { styled } from "styled-components";
import { FlexRow } from "../../common";
import Editor from "../../common/editor/editor";
import { setNeuron, thunkGetNeuron } from "../../redux/neuronSlice";
import { setNeuron, thunkGetNeuron, thunkUpdateNeuron } from "../../redux/neuronSlice";
import { RootState, useAppDispatch } from "../../redux/store";

const Post = () => {
Expand Down Expand Up @@ -38,9 +38,11 @@ const Post = () => {
}, [selected])

const saveNeuron = () => {
// onSave(item);
setPristine(true);
setInitial(item)
if (item) {
dispatch(thunkUpdateNeuron(item))
setPristine(true);
setInitial(item)
}
}

const onView = () => {
Expand All @@ -51,7 +53,8 @@ const Post = () => {
setEditMode(true)
}

if (loading) {
if (loading && !editMode) {
// Don't show it if in Edit mode
return <Container>Loading...</Container>
}

Expand Down

0 comments on commit a9c3f81

Please sign in to comment.