upd: toast alert
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user