Fixed front ann book and delete err handling

Button no longer pre-updates on err
File uploading fix
This commit is contained in:
2023-09-13 22:26:53 +03:00
parent a60ff39c43
commit 2b001579c5
4 changed files with 10 additions and 6 deletions

View File

@ -14,8 +14,8 @@ function useAddAnnouncement() {
processPutAnnouncement
)
function handleAdd(formData: FormData) {
void doSend({}, {
async function handleAdd(formData: FormData) {
await doSend({}, {
body: formData,
})
}

View File

@ -15,8 +15,8 @@ function useBook() {
processBook,
)
const handleBook = useCallback((id: number) => {
void doSend({}, {
const handleBook = useCallback(async (id: number) => {
await doSend({}, {
body: JSON.stringify({
id,
}),

View File

@ -12,7 +12,7 @@ function useSendButtonCaption(
const [title, setTitle] = useState(initial)
const update = useCallback(<T extends NonNullable<unknown>>(data: T | null | undefined) => {
if (data !== undefined) { // not loading
if (data !== undefined && data !== null) { // not loading or error
setCaption(result)
setTitle('Отправить ещё раз')