upd: toast alert

This commit is contained in:
2026-02-24 17:44:49 +08:00
parent 214a243e44
commit 8c6ff06216
67 changed files with 384 additions and 187 deletions

View File

@@ -89,9 +89,11 @@ export default function DiscussionDivisionEdit() {
} else {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
} catch (error: any) {
console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
const message = error?.response?.data?.message || "Gagal mengubah data"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

View File

@@ -202,8 +202,11 @@ export default function DiscussionDetail() {
setKomentar("")
updateTrigger()
}
} catch (error) {
} catch (error: any) {
console.error(error);
const message = error?.response?.data?.message || "Gagal menambahkan komentar"
Toast.show({ type: 'small', text1: message })
} finally {
setLoadingSend(false);
}
@@ -222,8 +225,11 @@ export default function DiscussionDetail() {
} else {
Toast.show({ type: 'small', text1: response.message })
}
} catch (error) {
} catch (error : any ) {
console.error(error);
const message = error?.response?.data?.message || "Gagal mengedit komentar"
Toast.show({ type: 'small', text1: message })
} finally {
setLoadingSend(false);
handleViewEditKomentar()
@@ -243,8 +249,11 @@ export default function DiscussionDetail() {
} else {
Toast.show({ type: 'small', text1: response.message })
}
} catch (error) {
} catch (error : any ) {
console.error(error);
const message = error?.response?.data?.message || "Gagal menghapus komentar"
Toast.show({ type: 'small', text1: message })
} finally {
setLoadingSend(false)
setVisible(false)

View File

@@ -81,9 +81,11 @@ export default function CreateDiscussionDivision() {
} else {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
console.error(error)
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
} catch (error: any) {
console.error(error);
const message = error?.response?.data?.message || "Gagal menambahkan data"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}