mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
added delete message action
This commit is contained in:
parent
47cd66496b
commit
600b8bb1e8
3 changed files with 15 additions and 2 deletions
|
@ -15,16 +15,22 @@ const mapStateToProps = state => ({
|
|||
|
||||
const mapDispatchToProps = {
|
||||
authGetMessages: AUTH_ACTIONS.authGetMessages,
|
||||
authDeleteMessage: AUTH_ACTIONS.authDeleteMessage,
|
||||
};
|
||||
|
||||
type IProps = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {};
|
||||
|
||||
const ProfileMessagesUnconnected: FC<IProps> = ({ profile, user: { id }, authGetMessages }) => {
|
||||
const ProfileMessagesUnconnected: FC<IProps> = ({
|
||||
profile,
|
||||
user: { id },
|
||||
authGetMessages,
|
||||
authDeleteMessage,
|
||||
}) => {
|
||||
const [editingMessageId, setEditingMessageId] = useState(0);
|
||||
|
||||
const onEditMessage = useCallback((id: number) => setEditingMessageId(id), [setEditingMessageId]);
|
||||
const onCancelEdit = useCallback(() => setEditingMessageId(0), [setEditingMessageId]);
|
||||
const onDeleteMessage = useCallback((id: number) => console.log({ id }), []);
|
||||
const onDeleteMessage = useCallback((id: number) => authDeleteMessage(id), [authDeleteMessage]);
|
||||
|
||||
useEffect(() => {
|
||||
if (profile.is_loading || !profile.user || !profile.user.username) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue