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

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

View File

@@ -38,9 +38,11 @@ export default function HeaderRightCalendarDetail({ id, idReminder }: Props) {
} 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 data"
Toast.show({ type: 'small', text1: message })
} finally {
setVisible(false)
}

View File

@@ -40,9 +40,11 @@ export default function HeaderRightDiscussionDetail({ id, status, isActive }: Pr
} 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 {
setVisible(false)
}
@@ -59,9 +61,11 @@ export default function HeaderRightDiscussionDetail({ id, status, isActive }: Pr
} 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 {
setVisible(false)
}

View File

@@ -37,9 +37,11 @@ export default function HeaderRightDivisionInfo({ id, active }: Props) {
} 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"
Toast.show({ type: 'small', text1: message })
} finally {
setVisible(false)
}

View File

@@ -40,9 +40,11 @@ export default function HeaderRightDocument({ path, isMember }: { path: string,
} 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 folder"
Toast.show({ type: 'small', text1: message })
} finally {
setLoadingFolder(false)
setNewFolder(false)
@@ -93,9 +95,11 @@ export default function HeaderRightDocument({ path, isMember }: { path: string,
} 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 mengunggah file"
Toast.show({ type: 'small', text1: message })
} finally {
setVisible(false)
setLoading(false)

View File

@@ -71,9 +71,11 @@ export default function ModalMore({
} 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 memindahkan file"
Toast.show({ type: 'small', text1: message })
} finally {
setIsCut(false);
onClose();
@@ -95,9 +97,11 @@ export default function ModalMore({
} 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 menyalin file"
Toast.show({ type: 'small', text1: message })
} finally {
setIsCopy(false);
onClose();

View File

@@ -29,9 +29,11 @@ export function ModalNewFolder({ path, onCreated }: { path: string, onCreated: (
} 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 folder"
Toast.show({ type: 'small', text1: message })
} finally {
onCreated()
setLoadingFolder(false)

View File

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

View File

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

View File

@@ -86,9 +86,11 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
} 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 file"
Toast.show({ type: 'small', text1: message })
} finally {
setModal(false)
}

View File

@@ -68,9 +68,11 @@ export default function SectionLink({ status, member, refreshing }: { status: nu
} 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 link"
Toast.show({ type: 'small', text1: message })
} finally {
setModal(false)
}

View File

@@ -88,8 +88,11 @@ export default function SectionMember({ status, refreshing }: { status: number |
dispatch(setUpdateProject({ ...update, member: !update.member }))
setModal(false);
}
} catch (error) {
} catch (error : any ) {
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);
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
}
} catch (error) {
} catch (error : any ) {
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);
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
}
} catch (error) {
} catch (error : any ) {
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 {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
} catch (error : any ) {
console.error(error)
const message = error?.response?.data?.message || "Gagal menghapus tugas"
Toast.show({ type: 'small', text1: message })
} finally {
setVisible(false)
}
@@ -62,8 +65,11 @@ export default function HeaderRightTaskDetail({ id, division, status, isAdminDiv
} else {
Toast.show({ type: 'small', text1: 'Gagal menambahkan link', })
}
} catch (error) {
} catch (error : any ) {
console.error(error)
const message = error?.response?.data?.message || "Gagal menambahkan link"
Toast.show({ type: 'small', text1: message })
} finally {
setAddLink(false)
}

View File

@@ -119,9 +119,11 @@ export default function SectionFileTask({ refreshing, isMemberDivision }: { refr
} 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 file"
Toast.show({ type: 'small', text1: message })
} finally {
setModal(false)
}

View File

@@ -62,9 +62,11 @@ export default function SectionLinkTask({ refreshing, isMemberDivision }: { refr
} 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 link"
Toast.show({ type: 'small', text1: message })
} finally {
setModal(false)
}

View File

@@ -88,9 +88,11 @@ export default function SectionMemberTask({ refreshing, isAdminDivision }: { ref
} else {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
} catch (error : any ) {
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 {
setModal(false);
}

View File

@@ -73,9 +73,11 @@ export default function SectionTanggalTugasTask({ refreshing, isMemberDivision }
} else {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
} catch (error : any ) {
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 {
setSelect(false)
}
@@ -109,9 +111,11 @@ export default function SectionTanggalTugasTask({ refreshing, isMemberDivision }
} else {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
} catch (error : any ) {
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 {
setModal(false);
}