Fixed ann removal

This commit is contained in:
2023-07-29 18:43:44 +03:00
parent e214ea53e7
commit cf81e3d817
6 changed files with 53 additions and 27 deletions

View File

@ -11,7 +11,8 @@ import { useId } from '../hooks'
type AnnouncementDetailsProps = {
close: () => void,
announcement: Announcement
refresh: () => void,
announcement: Announcement,
}
const styles = {
@ -26,11 +27,17 @@ const styles = {
} as CSSProperties,
}
function AnnouncementDetails({ close, announcement: {
function AnnouncementDetails({ close, refresh, announcement: {
id, name, category, bestBy, description, lat, lng, address, metro, bookedBy, userId
} }: AnnouncementDetailsProps) {
const { handleBook, bookButton } = useBook()
const { handleRemove, removeButton } = useRemoveAnnouncement(close)
const removeRefresh = () => {
close()
refresh()
}
const { handleRemove, removeButton } = useRemoveAnnouncement(removeRefresh)
const myId = useId()