|
@@ -2,7 +2,7 @@ import { Button, Divider, message } from "antd"
|
|
import Title from "antd/lib/typography/Title"
|
|
import Title from "antd/lib/typography/Title"
|
|
import { useEffect, useState } from "react"
|
|
import { useEffect, useState } from "react"
|
|
import { connect } from "react-redux"
|
|
import { connect } from "react-redux"
|
|
-import { actionAddPostsFeedAC, actionFullSentPost, actionRemovePostsFeedAC, } from "../actions"
|
|
|
|
|
|
+import { actionAddPostAC, actionClearPromise, actionFullSentPost, actionRemovePostAC, } from "../actions"
|
|
import { EditPhotos } from "../components/uploadPhoto/EditPhotos"
|
|
import { EditPhotos } from "../components/uploadPhoto/EditPhotos"
|
|
import { EditDescriptionPost } from "../components/uploadPhoto/EditDescriptionPost"
|
|
import { EditDescriptionPost } from "../components/uploadPhoto/EditDescriptionPost"
|
|
import { EditTitlePost } from "../components/uploadPhoto/EditTitlePost"
|
|
import { EditTitlePost } from "../components/uploadPhoto/EditTitlePost"
|
|
@@ -13,7 +13,7 @@ import { history } from '../App'
|
|
const ContainEditorPost = ({ children }) =>
|
|
const ContainEditorPost = ({ children }) =>
|
|
<div className='ContainEditPost ContainerInner'>{children}</div>
|
|
<div className='ContainEditPost ContainerInner'>{children}</div>
|
|
|
|
|
|
-const EntityEditorPost = ({ match: { params: { _id } }, myID, entity, status, onSave, updatePost, clearState }) => {
|
|
|
|
|
|
+const EntityEditorPost = ({ match: { params: { _id } }, myID, entity, status, onSave, updatePost, clearState, clearStatus }) => {
|
|
|
|
|
|
const [photos, setPhotos] = useState(entity?.images || []);
|
|
const [photos, setPhotos] = useState(entity?.images || []);
|
|
const [titleSend, setTitleSend] = useState(entity?.title || '')
|
|
const [titleSend, setTitleSend] = useState(entity?.title || '')
|
|
@@ -35,6 +35,7 @@ const EntityEditorPost = ({ match: { params: { _id } }, myID, entity, status, on
|
|
}
|
|
}
|
|
return () => {
|
|
return () => {
|
|
clearState()
|
|
clearState()
|
|
|
|
+ clearStatus('sentPost')
|
|
}
|
|
}
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
@@ -67,11 +68,12 @@ const EntityEditorPost = ({ match: { params: { _id } }, myID, entity, status, on
|
|
|
|
|
|
export const CEntityEditorPost = connect(state => ({
|
|
export const CEntityEditorPost = connect(state => ({
|
|
myID: state?.auth?.payload?.sub?.id,
|
|
myID: state?.auth?.payload?.sub?.id,
|
|
- entity: state?.postsFeed.posts,
|
|
|
|
|
|
+ entity: state?.post.posts,
|
|
status: state?.promise?.sentPost?.status
|
|
status: state?.promise?.sentPost?.status
|
|
}),
|
|
}),
|
|
{
|
|
{
|
|
- updatePost: actionAddPostsFeedAC,
|
|
|
|
|
|
+ updatePost: actionAddPostAC,
|
|
onSave: actionFullSentPost,
|
|
onSave: actionFullSentPost,
|
|
- clearState: actionRemovePostsFeedAC,
|
|
|
|
|
|
+ clearState: actionRemovePostAC,
|
|
|
|
+ clearStatus: actionClearPromise
|
|
})(EntityEditorPost)
|
|
})(EntityEditorPost)
|