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

@@ -52,7 +52,6 @@ export default function RootLayout() {
const checkVersion = async () => { const checkVersion = async () => {
try { try {
const response = await apiGetVersion(); const response = await apiGetVersion();
console.log('response',response)
if (response.success && response.data) { if (response.success && response.data) {
const maintenance = response.data.find((item: any) => item.id === 'mobile_maintenance')?.value === 'true'; const maintenance = response.data.find((item: any) => item.id === 'mobile_maintenance')?.value === 'true';
const latestVersion = response.data.find((item: any) => item.id === 'mobile_latest_version')?.value || '0.0.0'; const latestVersion = response.data.find((item: any) => item.id === 'mobile_latest_version')?.value || '0.0.0';

View File

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

View File

@@ -78,6 +78,7 @@ export default function CreateAnnouncement() {
async function handleCreate() { async function handleCreate() {
try { try {
setLoading(true) setLoading(true)
console.log('jalan')
const hasil = await decryptToken(String(token?.current)) const hasil = await decryptToken(String(token?.current))
const fd = new FormData() const fd = new FormData()
@@ -90,7 +91,7 @@ export default function CreateAnnouncement() {
} }
fd.append("data", JSON.stringify( fd.append("data", JSON.stringify(
{ user: hasil, groups: divisionMember, ...dataForm } { user: 'apaya', groups: divisionMember, ...dataForm }
)) ))
const response = await apiCreateAnnouncement(fd) const response = await apiCreateAnnouncement(fd)
@@ -100,11 +101,16 @@ export default function CreateAnnouncement() {
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', }) Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
router.back(); router.back();
} else { } else {
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', }) const message = error?.response?.data?.message || "Tidak dapat terhubung ke server"
Toast.show({
type: 'small',
text1: message
})
} finally { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -147,9 +147,11 @@ export default function EditAnnouncement() {
} else { } else {
Toast.show({ type: 'small', text1: 'Gagal mengubah data', }) Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
} }
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Gagal mengubah data', }) const message = error?.response?.data?.message || "Gagal mengubah data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setLoading(false) setLoading(false)
} }
@@ -309,7 +311,7 @@ export default function EditAnnouncement() {
<View style={[Styles.rowSpaceBetween, Styles.mv05]}> <View style={[Styles.rowSpaceBetween, Styles.mv05]}>
<Text style={[Styles.textDefaultSemiBold]}>Divisi</Text> <Text style={[Styles.textDefaultSemiBold]}>Divisi</Text>
</View> </View>
<View style={[Styles.borderAll, Styles.round05, Styles.p10, {backgroundColor: colors.card, borderColor: colors.icon + '20' }]}> <View style={[Styles.borderAll, Styles.round05, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
{ {
dataMember.map((item: { name: any; Division: any }, index: any) => { dataMember.map((item: { name: any; Division: any }, index: any) => {
return ( return (

View File

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

View File

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

View File

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

View File

@@ -158,8 +158,11 @@ export default function DetailDiscussionGeneral() {
Toast.show({ type: 'small', text1: response.message }) Toast.show({ type: 'small', text1: response.message })
} }
} }
} catch (error) { } catch (error: any) {
console.error(error) console.error(error);
const message = error?.response?.data?.message || "Gagal menambahkan data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setLoadingSendKomentar(false) setLoadingSendKomentar(false)
} }
@@ -175,8 +178,11 @@ export default function DetailDiscussionGeneral() {
} else { } else {
Toast.show({ type: 'small', text1: response.message }) Toast.show({ type: 'small', text1: response.message })
} }
} catch (error) { } catch (error: any) {
console.error(error) console.error(error);
const message = error?.response?.data?.message || "Gagal mengupdate data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setLoadingSendKomentar(false) setLoadingSendKomentar(false)
handleViewEditKomentar() handleViewEditKomentar()
@@ -193,8 +199,11 @@ export default function DetailDiscussionGeneral() {
} else { } else {
Toast.show({ type: 'small', text1: response.message }) Toast.show({ type: 'small', text1: response.message })
} }
} catch (error) { } catch (error: any) {
console.error(error) console.error(error);
const message = error?.response?.data?.message || "Gagal menghapus data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setLoadingSendKomentar(false) setLoadingSendKomentar(false)
setVisible(false) setVisible(false)

View File

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

View File

@@ -156,9 +156,11 @@ export default function CreateDiscussionGeneral() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error: any) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -157,9 +157,11 @@ export default function EditDiscussionGeneral() {
} else { } else {
Toast.show({ type: 'small', text1: 'Gagal mengubah data', }) Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
} }
} catch (error) { } catch (error: any) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -67,8 +67,11 @@ export default function MemberDiscussionDetail() {
await apiDeleteMemberDiscussionGeneral({ user: hasil, idUser: chooseUser.idUser }, id) await apiDeleteMemberDiscussionGeneral({ user: hasil, idUser: chooseUser.idUser }, id)
Toast.show({ type: 'small', text1: 'Berhasil mengeluarkan anggota dari diskusi', }) Toast.show({ type: 'small', text1: 'Berhasil mengeluarkan anggota dari diskusi', })
handleLoad(false) handleLoad(false)
} catch (error) { } catch (error: any) {
console.error(error) console.error(error);
const message = error?.response?.data?.message || "Gagal mengeluarkan anggota"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false) setModal(false)
} }

View File

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

View File

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

View File

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

View File

@@ -89,9 +89,11 @@ export default function DiscussionDivisionEdit() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error: any) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

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

View File

@@ -81,9 +81,11 @@ export default function CreateDiscussionDivision() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error: any) {
console.error(error) 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -235,9 +235,11 @@ export default function DocumentDivision() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoadingRename(false) setLoadingRename(false)
setRename(false) setRename(false)
@@ -258,9 +260,11 @@ export default function DocumentDivision() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setShare(false); setShare(false);
} }

View File

@@ -120,9 +120,11 @@ export default function TaskDivisionAddFile() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

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

View File

@@ -133,9 +133,11 @@ export default function TaskDivisionAddTask() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -62,9 +62,11 @@ export default function TaskDivisionCancel() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -80,9 +80,11 @@ export default function TaskDivisionEdit() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -80,9 +80,11 @@ export default function TaskDivisionReport() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -105,9 +105,11 @@ export default function CreateTaskDivision() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -125,9 +125,11 @@ export default function UpdateProjectTaskDivision() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoadingSubmit(false) setLoadingSubmit(false)
} }

View File

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

View File

@@ -56,9 +56,11 @@ export default function EditDivision() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error: any) {
console.error(error) 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -78,9 +78,11 @@ export default function InformationDivision() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error: any) {
console.error(error) console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal mengeluarkan anggota"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false) setModal(false)
} }
@@ -96,9 +98,11 @@ export default function InformationDivision() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error: any) {
console.error(error) console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal mengubah status admin"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false) setModal(false)
} }

View File

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

View File

@@ -77,9 +77,11 @@ export default function CreateDivision() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error: any) {
console.error(error) 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 { } finally {
setLoadingBtn(false) setLoadingBtn(false)
} }

View File

@@ -66,9 +66,11 @@ export default function CreateDivisionAddAdmin() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

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

View File

@@ -188,9 +188,14 @@ export default function EditProfile() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error: any) {
console.error(error) console.error(error);
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', }) const message = error?.response?.data?.message || "Gagal mengupdate data"
Toast.show({
type: 'small',
text1: message
})
} finally { } finally {
setLoading(false) setLoading(false)
} }

View File

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

View File

@@ -185,9 +185,11 @@ export default function CreateMember() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -211,9 +211,11 @@ export default function EditMember() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -88,8 +88,11 @@ export default function Index() {
const hasil = await decryptToken(String(token?.current)) const hasil = await decryptToken(String(token?.current))
const response = await apiDeletePosition({ user: hasil, isActive: chooseData.active }, chooseData.id) const response = await apiDeletePosition({ user: hasil, isActive: chooseData.active }, chooseData.id)
dispatch(setUpdatePosition(!update)) dispatch(setUpdatePosition(!update))
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error);
const message = error?.response?.data?.message || "Gagal menghapus data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false) setModal(false)
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', }) Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
@@ -107,8 +110,11 @@ export default function Index() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error);
const message = error?.response?.data?.message || "Gagal mengubah data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setLoadingSubmit(false) setLoadingSubmit(false)
setVisibleEdit(false) setVisibleEdit(false)

View File

@@ -118,9 +118,11 @@ export default function ProjectAddFile() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -45,9 +45,11 @@ export default function AddMemberProject() {
setIdGroup(responseGroup.data.idGroup) setIdGroup(responseGroup.data.idGroup)
const responsemember = await apiGetUser({ user: hasil, active: "true", search: search, group: String(responseGroup.data.idGroup) }) const responsemember = await apiGetUser({ user: hasil, active: "true", search: search, group: String(responseGroup.data.idGroup) })
setData(responsemember.data.filter((i: any) => i.idUserRole != 'supadmin')) setData(responsemember.data.filter((i: any) => i.idUserRole != 'supadmin'))
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal mengambil data"
Toast.show({ type: 'small', text1: message })
} }
} }
@@ -86,9 +88,11 @@ export default function AddMemberProject() {
dispatch(setUpdateProject({ ...update, member: !update.member })) dispatch(setUpdateProject({ ...update, member: !update.member }))
router.back() router.back()
} }
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal menambahkan anggota"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -126,9 +126,11 @@ export default function ProjectAddTask() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -58,9 +58,11 @@ export default function ProjectCancel() {
Toast.show({ type: 'small', text1: 'Berhasil membatalkan kegiatan', }) Toast.show({ type: 'small', text1: 'Berhasil membatalkan kegiatan', })
router.back(); router.back();
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -77,9 +77,11 @@ export default function EditProject() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -77,9 +77,11 @@ export default function ReportProject() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -151,9 +151,11 @@ export default function CreateProject() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) 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 { } finally {
setLoading(false) setLoading(false)
} }

View File

@@ -118,9 +118,11 @@ export default function UpdateProjectTask() {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); 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 { } finally {
setLoadingSubmit(false) setLoadingSubmit(false)
} }

View File

@@ -65,9 +65,14 @@ export default function Search() {
setDataDivisi([]) setDataDivisi([])
setDataProject([]) setDataProject([])
} }
} catch (error) { } catch (error: any) {
console.error(error) console.error(error);
return Toast.show({ type: 'small', text1: 'Gagal melakukan pencarian', }) const message = error?.response?.data?.message || "Gagal melakukan pencarian"
Toast.show({
type: 'small',
text1: message
})
} }
} }

View File

@@ -38,13 +38,18 @@ export default function ViewLogin({ onValidate }: Props) {
if (responseOtp == 200) { if (responseOtp == 200) {
await AsyncStorage.setItem('user', response.id) await AsyncStorage.setItem('user', response.id)
return onValidate({ phone: `62${phone}`, otp }) return onValidate({ phone: `62${phone}`, otp })
} else {
return Toast.show({ type: 'small', text1: 'Gagal mengirim kode verifikasi', position: 'bottom' })
} }
} }
} else { } else {
return Toast.show({ type: 'small', text1: response.message, position: 'bottom' }) return Toast.show({ type: 'small', text1: response.message, position: 'bottom' })
} }
} catch (error) { } catch (error : any ) {
return Toast.show({ type: 'small', text1: `Terjadi kesalahan, coba lagi`, position: 'bottom' }) console.error(error);
const message = error?.response?.data?.message || "Gagal login"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setLoadingLogin(false) setLoadingLogin(false)
} }

View File

@@ -38,9 +38,11 @@ export default function HeaderRightCalendarDetail({ id, idReminder }: Props) {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal menghapus data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setVisible(false) setVisible(false)
} }

View File

@@ -40,9 +40,11 @@ export default function HeaderRightDiscussionDetail({ id, status, isActive }: Pr
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) 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 { } finally {
setVisible(false) setVisible(false)
} }
@@ -59,9 +61,11 @@ export default function HeaderRightDiscussionDetail({ id, status, isActive }: Pr
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) 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 { } finally {
setVisible(false) setVisible(false)
} }

View File

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

View File

@@ -40,9 +40,11 @@ export default function HeaderRightDocument({ path, isMember }: { path: string,
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal membuat folder"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setLoadingFolder(false) setLoadingFolder(false)
setNewFolder(false) setNewFolder(false)
@@ -93,9 +95,11 @@ export default function HeaderRightDocument({ path, isMember }: { path: string,
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal mengunggah file"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setVisible(false) setVisible(false)
setLoading(false) setLoading(false)

View File

@@ -71,9 +71,11 @@ export default function ModalMore({
} else { } else {
Toast.show({ type: 'small', text1: response.message, }); Toast.show({ type: 'small', text1: response.message, });
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }); const message = error?.response?.data?.message || "Gagal memindahkan file"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setIsCut(false); setIsCut(false);
onClose(); onClose();
@@ -95,9 +97,11 @@ export default function ModalMore({
} else { } else {
Toast.show({ type: 'small', text1: response.message, }); Toast.show({ type: 'small', text1: response.message, });
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }); const message = error?.response?.data?.message || "Gagal menyalin file"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setIsCopy(false); setIsCopy(false);
onClose(); onClose();

View File

@@ -29,9 +29,11 @@ export function ModalNewFolder({ path, onCreated }: { path: string, onCreated: (
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal membuat folder"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
onCreated() onCreated()
setLoadingFolder(false) setLoadingFolder(false)

View File

@@ -37,8 +37,11 @@ export default function HeaderRightMemberDetail({ active, id }: Props) {
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error);
const message = error?.response?.data?.message || "Gagal mengupdate data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setVisible(false) setVisible(false)
} }

View File

@@ -44,8 +44,11 @@ export default function HeaderRightProjectDetail({ id, status }: Props) {
} else { } else {
Toast.show({ type: 'small', text1: 'Gagal menghapus kegiatan', }) Toast.show({ type: 'small', text1: 'Gagal menghapus kegiatan', })
} }
} catch (error) { } catch (error :any ) {
console.error(error) console.error(error)
const message = error?.response?.data?.message || "Gagal menghapus kegiatan"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setVisible(false) setVisible(false)
} }
@@ -61,8 +64,11 @@ export default function HeaderRightProjectDetail({ id, status }: Props) {
} else { } else {
Toast.show({ type: 'small', text1: 'Gagal menambahkan link', }) Toast.show({ type: 'small', text1: 'Gagal menambahkan link', })
} }
} catch (error) { } catch (error :any ) {
console.error(error) console.error(error)
const message = error?.response?.data?.message || "Gagal menambahkan link"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setAddLink(false) setAddLink(false)
} }

View File

@@ -86,9 +86,11 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal menghapus file"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false) setModal(false)
} }

View File

@@ -68,9 +68,11 @@ export default function SectionLink({ status, member, refreshing }: { status: nu
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal menghapus link"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false) setModal(false)
} }

View File

@@ -88,8 +88,11 @@ export default function SectionMember({ status, refreshing }: { status: number |
dispatch(setUpdateProject({ ...update, member: !update.member })) dispatch(setUpdateProject({ ...update, member: !update.member }))
setModal(false); setModal(false);
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
const message = error?.response?.data?.message || "Gagal menghapus anggota"
Toast.show({ type: 'small', text1: message })
} }
} }

View File

@@ -91,8 +91,11 @@ export default function SectionTanggalTugasProject({ status, member, refreshing
setSelect(false); setSelect(false);
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', }) Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
const message = error?.response?.data?.message || "Gagal mengubah data"
Toast.show({ type: 'small', text1: message })
} }
} }
@@ -108,8 +111,11 @@ export default function SectionTanggalTugasProject({ status, member, refreshing
setModal(false); setModal(false);
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', }) Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
const message = error?.response?.data?.message || "Gagal menghapus data"
Toast.show({ type: 'small', text1: message })
} }
} }

View File

@@ -45,8 +45,11 @@ export default function HeaderRightTaskDetail({ id, division, status, isAdminDiv
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error)
const message = error?.response?.data?.message || "Gagal menghapus tugas"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setVisible(false) setVisible(false)
} }
@@ -62,8 +65,11 @@ export default function HeaderRightTaskDetail({ id, division, status, isAdminDiv
} else { } else {
Toast.show({ type: 'small', text1: 'Gagal menambahkan link', }) Toast.show({ type: 'small', text1: 'Gagal menambahkan link', })
} }
} catch (error) { } catch (error : any ) {
console.error(error) console.error(error)
const message = error?.response?.data?.message || "Gagal menambahkan link"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setAddLink(false) setAddLink(false)
} }

View File

@@ -119,9 +119,11 @@ export default function SectionFileTask({ refreshing, isMemberDivision }: { refr
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal menghapus file"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false) setModal(false)
} }

View File

@@ -62,9 +62,11 @@ export default function SectionLinkTask({ refreshing, isMemberDivision }: { refr
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', }) const message = error?.response?.data?.message || "Gagal menghapus link"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false) setModal(false)
} }

View File

@@ -88,9 +88,11 @@ export default function SectionMemberTask({ refreshing, isAdminDivision }: { ref
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Gagal menghapus anggota', }) const message = error?.response?.data?.message || "Gagal menghapus anggota"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false); setModal(false);
} }

View File

@@ -73,9 +73,11 @@ export default function SectionTanggalTugasTask({ refreshing, isMemberDivision }
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Gagal mengubah data', }) const message = error?.response?.data?.message || "Gagal mengubah data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setSelect(false) setSelect(false)
} }
@@ -109,9 +111,11 @@ export default function SectionTanggalTugasTask({ refreshing, isMemberDivision }
} else { } else {
Toast.show({ type: 'small', text1: response.message, }) Toast.show({ type: 'small', text1: response.message, })
} }
} catch (error) { } catch (error : any ) {
console.error(error); console.error(error);
Toast.show({ type: 'small', text1: 'Gagal menghapus data', }) const message = error?.response?.data?.message || "Gagal menghapus data"
Toast.show({ type: 'small', text1: message })
} finally { } finally {
setModal(false); setModal(false);
} }