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

@@ -92,9 +92,11 @@ export default function AddMemberCalendarEvent() {
} 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 anggota"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

View File

@@ -57,9 +57,11 @@ export default function EditEventCalendar() {
setData({ ...response.data, dateStart: moment(response.data.dateStartFormat, 'DD-MM-YYYY').format('DD-MM-YYYY') })
setIdCalendar(response.data.idCalendar)
setChoose({ val: response.data.repeatEventTyper, label: valueTypeEventRepeat.find((item) => item.id == response.data.repeatEventTyper)?.name || "" })
} catch (error) {
} catch (error: any) {
console.error(error);
Toast.show({ type: 'small', text1: 'Gagal mendapatkan data', })
const message = error?.response?.data?.message || "Gagal mendapatkan data"
Toast.show({ type: 'small', text1: message })
}
}
@@ -154,9 +156,11 @@ export default function EditEventCalendar() {
} 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 mengubah acara"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

View File

@@ -137,9 +137,11 @@ export default function DetailEventCalendar() {
dispatch(setUpdateCalendar({ ...update, member: !update.member }));
}
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 menghapus anggota"
Toast.show({ type: 'small', text1: message })
} finally {
setModalMember(false)
}

View File

@@ -83,9 +83,11 @@ export default function CreateCalendarAddMember() {
} 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 membuat acara"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

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)
}

View File

@@ -235,9 +235,11 @@ export default function DocumentDivision() {
} 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 nama"
Toast.show({ type: 'small', text1: message })
} finally {
setLoadingRename(false)
setRename(false)
@@ -258,9 +260,11 @@ export default function DocumentDivision() {
} 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 menghapus"
Toast.show({ type: 'small', text1: message })
}
}
@@ -284,9 +288,11 @@ export default function DocumentDivision() {
} 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 membagikan"
Toast.show({ type: 'small', text1: message })
} finally {
setShare(false);
}

View File

@@ -120,9 +120,11 @@ export default function TaskDivisionAddFile() {
} 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 menambahkan file"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

View File

@@ -86,9 +86,11 @@ export default function AddMemberTask() {
} 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 anggota"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

View File

@@ -133,9 +133,11 @@ export default function TaskDivisionAddTask() {
} 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 menambahkan data"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

View File

@@ -62,9 +62,11 @@ export default function TaskDivisionCancel() {
} 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 membatalkan kegiatan"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

View File

@@ -80,9 +80,11 @@ export default function TaskDivisionEdit() {
} 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

@@ -80,9 +80,11 @@ export default function TaskDivisionReport() {
} 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

@@ -105,9 +105,11 @@ export default function CreateTaskDivision() {
} 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)
}

View File

@@ -125,9 +125,11 @@ export default function UpdateProjectTaskDivision() {
} 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 {
setLoadingSubmit(false)
}

View File

@@ -89,9 +89,11 @@ export default function AddMemberDivision() {
} 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 anggota"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

View File

@@ -56,9 +56,11 @@ export default function EditDivision() {
} 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 mengubah data"
Toast.show({ type: 'small', text1: message })
} finally {
setLoading(false)
}

View File

@@ -78,9 +78,11 @@ export default function InformationDivision() {
} 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 mengeluarkan anggota"
Toast.show({ type: 'small', text1: message })
} finally {
setModal(false)
}
@@ -96,9 +98,11 @@ export default function InformationDivision() {
} 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 mengubah status admin"
Toast.show({ type: 'small', text1: message })
} finally {
setModal(false)
}

View File

@@ -94,8 +94,11 @@ export default function ReportDivision() {
} else {
Toast.show({ type: 'small', text1: response.message, });
}
} catch (error) {
} catch (error: any) {
console.error(error);
const message = error?.response?.data?.message || "Gagal mengambil data"
Toast.show({ type: 'small', text1: message })
}
}