Fixed doSend arguments
This commit is contained in:
@@ -2,8 +2,8 @@ import { useSendWithButton } from '..'
|
||||
import { composePutAnnouncementURL, processPutAnnouncement } from '../../api/putAnnouncement'
|
||||
import { isPutAnnouncementResponse } from '../../api/putAnnouncement/types'
|
||||
|
||||
const useAddAnnouncement = () => (
|
||||
useSendWithButton(
|
||||
function useAddAnnouncement() {
|
||||
const { doSend, button } = useSendWithButton(
|
||||
'Опубликовать',
|
||||
'Опубликовано',
|
||||
true,
|
||||
@@ -13,6 +13,14 @@ const useAddAnnouncement = () => (
|
||||
isPutAnnouncementResponse,
|
||||
processPutAnnouncement
|
||||
)
|
||||
)
|
||||
|
||||
function handleAdd(formData: FormData) {
|
||||
void doSend({}, {
|
||||
body: formData
|
||||
})
|
||||
}
|
||||
|
||||
return { handleAdd, addButton: button }
|
||||
}
|
||||
|
||||
export default useAddAnnouncement
|
||||
|
@@ -25,7 +25,7 @@ function useBook() {
|
||||
)
|
||||
|
||||
const handleBook = useCallback((id: number) => {
|
||||
void doSend({
|
||||
void doSend({}, {
|
||||
body: JSON.stringify({
|
||||
id
|
||||
}),
|
||||
|
@@ -16,7 +16,7 @@ const useRemoveAnnouncement = (close: () => void) => {
|
||||
)
|
||||
|
||||
const doSendWithClose = useCallback(async (id: number) => {
|
||||
await doSend({
|
||||
await doSend({}, {
|
||||
body: JSON.stringify({
|
||||
id
|
||||
})
|
||||
|
Reference in New Issue
Block a user