File size: 758 Bytes
41a71fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { classNames } from '@/shared/lib/classNames/classNames';
import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button';
import { useDeletePost } from '../../lib/query/useDeletePost';
import cls from './DeletePost.module.scss';

interface DeletePostProps {
    className?: string;
    postId: number;
}

export const DeletePost = (props: DeletePostProps) => {
    const { className, postId } = props;
    const { mutate: onDelete } = useDeletePost();

    return (
        <Button
            className={classNames(cls.DeletePost, {}, [className])}
            theme={ButtonTheme.PRIMARY}
            size={ButtonSize.S}
            onClick={() => onDelete({ post_id: postId })}
        >
            Удалить
        </Button>
    );
};