diff --git a/app/(application)/(user)/_layout.tsx b/app/(application)/(user)/_layout.tsx index 657c4ce..b55638e 100644 --- a/app/(application)/(user)/_layout.tsx +++ b/app/(application)/(user)/_layout.tsx @@ -10,6 +10,13 @@ export default function UserLayout() { return ( <> + , + }} + /> { + if (text !== "Delete Account") { + return Toast.show({ + type: "error", + text1: "Ketik 'Delete Account' untuk menghapus akun", + }); + } + + AlertDefaultSystem({ + title: "Apakah anda yakin ingin menghapus akun ini?", + message: + "Semua data yang pernah anda buat akan terhapus secara permanen !", + textLeft: "Batal", + textRight: "Ya", + onPressRight: async () => { + const response = await apiDeleteUser({ id: user?.id as string }); + console.log("RESPONSE >> ", response); + logout(); + }, + }); + }; + + return ( + <> + + + + + + + + + Anda akan menghapus akun dengan nomor +{phone} + + + Ketik 'Delete Account' untuk menghapus akun + + + + + Submit + + + + + + + ); +} diff --git a/assets/images/constants/logo-hipmi.png b/assets/images/constants/logo-hipmi.png index d182ad0..a1dedb3 100644 Binary files a/assets/images/constants/logo-hipmi.png and b/assets/images/constants/logo-hipmi.png differ diff --git a/assets/images/constants/logo-hipmi_back.png b/assets/images/constants/logo-hipmi_back.png new file mode 100644 index 0000000..d182ad0 Binary files /dev/null and b/assets/images/constants/logo-hipmi_back.png differ diff --git a/components/Grid/GridCustom.tsx b/components/Grid/GridCustom.tsx index fdfc787..e23243e 100644 --- a/components/Grid/GridCustom.tsx +++ b/components/Grid/GridCustom.tsx @@ -109,6 +109,7 @@ const styles = StyleSheet.create({ flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-start", - marginInline: 0.1 + // marginInline: 0.1 + margin: 0.1 }, }); diff --git a/screens/Profile/ListPage.tsx b/screens/Profile/ListPage.tsx index e0e7844..628accd 100644 --- a/screens/Profile/ListPage.tsx +++ b/screens/Profile/ListPage.tsx @@ -84,7 +84,7 @@ export const drawerItemsProfile = ({ ), label: "Hapus Akun", color: MainColor.red, - path: `https://cld-dkr-staging-hipmi.wibudev.com/delete-account?phone=${user?.nomor}`, + path: `/(application)/(user)/delete-account?phone=${user?.nomor}`, value: "delete-account", }, { @@ -161,7 +161,7 @@ export const drawerItemsProfile = ({ ), label: "Hapus Akun", color: MainColor.red, - path: `https://cld-dkr-staging-hipmi.wibudev.com/delete-account?phone=${user?.nomor}`, + path: `/(application)/(user)/delete-account?phone=${user?.nomor}`, value: "delete-account", }, { diff --git a/screens/Profile/menuDrawerSection.tsx b/screens/Profile/menuDrawerSection.tsx index 89b4468..ac85368 100644 --- a/screens/Profile/menuDrawerSection.tsx +++ b/screens/Profile/menuDrawerSection.tsx @@ -2,6 +2,7 @@ import { AlertDefaultSystem } from "@/components"; import { IMenuDrawerItem } from "@/components/_Interface/types"; import MenuDrawerDynamicGrid from "@/components/Drawer/MenuDrawerDynamicGird"; import { useAuth } from "@/hooks/use-auth"; +import { apiDeleteUser } from "@/service/api-client/api-user"; import { openBrowser } from "@/utils/openBrower"; import { router } from "expo-router"; @@ -14,6 +15,8 @@ export default function Profile_MenuDrawerSection({ setIsDrawerOpen: (value: boolean) => void; logout: () => Promise; }) { + const { user } = useAuth(); + const handlePress = (item: IMenuDrawerItem) => { // console.log("ITEM >> ", item); if (item.value === "logout") { @@ -32,7 +35,20 @@ export default function Profile_MenuDrawerSection({ }); } else if (item.value === "delete-account") { console.log("PATH >> ", item.path); - openBrowser(item.path as any); + // openBrowser(item.path as any); + AlertDefaultSystem({ + title: "Apakah anda yakin ingin menghapus akun ini?", + message: + "Semua data yang pernah anda buat akan terhapus secara permanen!", + textLeft: "Batal", + textRight: "Ya", + onPressRight: async () => { + router.push(item.path as any); + + setIsDrawerOpen(false); + }, + onPressLeft: () => setIsDrawerOpen(false), + }); } else { console.log("PATH >> ", item.path); router.push(item.path as any); diff --git a/service/api-client/api-user.ts b/service/api-client/api-user.ts index 5e05653..0e4d854 100644 --- a/service/api-client/api-user.ts +++ b/service/api-client/api-user.ts @@ -10,3 +10,7 @@ export async function apiAllUser({ search }: { search: string }) { return response.data; } +export async function apiDeleteUser({id}:{id: string}) { + const response = await apiConfig.delete(`/mobile/user/${id}`); + return response.data; +}