upd: button save

Deskripsi:
- disable button saat udh submit

No Issues
This commit is contained in:
2025-08-04 13:56:33 +08:00
parent b7c44109a1
commit fafb52d87c
31 changed files with 211 additions and 64 deletions

View File

@@ -19,6 +19,7 @@ export default function ProjectCancel() {
const [reason, setReason] = useState("");
const [error, setError] = useState(false);
const [disable, setDisable] = useState(false);
const [loading, setLoading] = useState(false)
function onValidation(val: string) {
@@ -44,6 +45,7 @@ export default function ProjectCancel() {
async function handleCancel() {
try {
setLoading(true)
const hasil = await decryptToken(String(token?.current));
const response = await apiCancelProject({
reason: reason,
@@ -56,6 +58,9 @@ export default function ProjectCancel() {
}
} catch (error) {
console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
} finally {
setLoading(false)
}
}
@@ -74,7 +79,7 @@ export default function ProjectCancel() {
headerTitleAlign: "center",
headerRight: () => (
<ButtonSaveHeader
disable={disable}
disable={disable || loading}
category="cancel"
onPress={() => {
handleCancel();