Fix apple rejected:
- app/(application)/(user)/delete-account.tsx - screens/Profile/menuDrawerSection.tsx ### No Issue
This commit is contained in:
@@ -19,6 +19,7 @@ export default function DeleteAccount() {
|
|||||||
const { token, logout, user } = useAuth();
|
const { token, logout, user } = useAuth();
|
||||||
const { phone } = useLocalSearchParams();
|
const { phone } = useLocalSearchParams();
|
||||||
const [text, setText] = useState("");
|
const [text, setText] = useState("");
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
const deleteAccount = async () => {
|
const deleteAccount = async () => {
|
||||||
if (text !== "Delete Account") {
|
if (text !== "Delete Account") {
|
||||||
@@ -29,15 +30,38 @@ export default function DeleteAccount() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AlertDefaultSystem({
|
AlertDefaultSystem({
|
||||||
title: "Apakah anda yakin ingin menghapus akun ini?",
|
title: "Anda yakin akan menghapus akun ini?",
|
||||||
message:
|
message:
|
||||||
"Semua data yang pernah anda buat akan terhapus secara permanen !",
|
"Semua data yang pernah anda buat akan terhapus secara permanen !",
|
||||||
textLeft: "Batal",
|
textLeft: "Batal",
|
||||||
textRight: "Ya",
|
textRight: "Ya",
|
||||||
onPressRight: async () => {
|
onPressRight: async () => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
const response = await apiDeleteUser({ id: user?.id as string });
|
const response = await apiDeleteUser({ id: user?.id as string });
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
console.log("RESPONSE >> ", response);
|
console.log("RESPONSE >> ", response);
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Akun berhasil dihapus",
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
logout();
|
logout();
|
||||||
|
setLoading(false);
|
||||||
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Gagal menghapus akun",
|
||||||
|
});
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("ERROR >> ", error);
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -73,6 +97,8 @@ export default function DeleteAccount() {
|
|||||||
backgroundColor="red"
|
backgroundColor="red"
|
||||||
textColor="white"
|
textColor="white"
|
||||||
onPress={deleteAccount}
|
onPress={deleteAccount}
|
||||||
|
isLoading={isLoading}
|
||||||
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
Submit
|
Submit
|
||||||
</ButtonCustom>
|
</ButtonCustom>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export default function Profile_MenuDrawerSection({
|
|||||||
AlertDefaultSystem({
|
AlertDefaultSystem({
|
||||||
title: "Apakah anda yakin ingin menghapus akun ini?",
|
title: "Apakah anda yakin ingin menghapus akun ini?",
|
||||||
message:
|
message:
|
||||||
"Semua data yang pernah anda buat akan terhapus secara permanen!",
|
"Pilih 'Ya' untuk masuk ke halaman penghapusan akun",
|
||||||
textLeft: "Batal",
|
textLeft: "Batal",
|
||||||
textRight: "Ya",
|
textRight: "Ya",
|
||||||
onPressRight: async () => {
|
onPressRight: async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user