upd: project
Deskripsi; - hapus detail project task - edit detail project task - fix tambah detail project task No Issues
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetProjectOne, apiUpdateStatusProjectTask } from "@/lib/api";
|
||||
import { apiDeleteProjectTask, apiGetProjectOne, apiUpdateStatusProjectTask } from "@/lib/api";
|
||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
@@ -74,6 +74,23 @@ export default function SectionTanggalTugasProject() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiDeleteProjectTask({
|
||||
user: hasil,
|
||||
idProject: id,
|
||||
}, tugas.id);
|
||||
if (response.success) {
|
||||
dispatch(setUpdateProject({ ...update, progress: !update.progress, task: !update.task }))
|
||||
setModal(false);
|
||||
ToastAndroid.show("Berhasil menghapus data", ToastAndroid.SHORT);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
@@ -140,7 +157,7 @@ export default function SectionTanggalTugasProject() {
|
||||
title="Edit Tugas"
|
||||
onPress={() => {
|
||||
setModal(false);
|
||||
router.push(`/project/update/124`);
|
||||
router.push(`/project/update/${tugas.id}`);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -151,13 +168,7 @@ export default function SectionTanggalTugasProject() {
|
||||
AlertKonfirmasi({
|
||||
title: "Konfirmasi",
|
||||
desc: "Apakah anda yakin ingin menghapus data ini?",
|
||||
onPress: () => {
|
||||
setModal(false);
|
||||
ToastAndroid.show(
|
||||
"Berhasil menghapus data",
|
||||
ToastAndroid.SHORT
|
||||
);
|
||||
},
|
||||
onPress: () => { handleDelete() },
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user