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

@@ -30,6 +30,7 @@ export default function EditBanner() {
const [title, setTitle] = useState("");
const [error, setError] = useState(false);
const [imgForm, setImgForm] = useState<any>();
const [loading, setLoading] = useState(false)
const pickImageAsync = async () => {
let result = await ImagePicker.launchImageLibraryAsync({
@@ -71,6 +72,7 @@ export default function EditBanner() {
const handleUpdateEntity = async () => {
try {
setLoading(true)
const hasil = await decryptToken(String(token?.current));
const fd = new FormData();
@@ -105,6 +107,8 @@ export default function EditBanner() {
} catch (error) {
console.error(error);
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
} finally {
setLoading(false)
}
};
@@ -122,7 +126,7 @@ export default function EditBanner() {
headerTitle: "Edit Banner",
headerTitleAlign: "center",
headerRight: () => <ButtonSaveHeader
disable={title == "" || error ? true : false}
disable={title == "" || error || loading ? true : false}
onPress={() => { handleUpdateEntity() }}
category="update" />,
}}