fix: jabatan

Deskripsi:
- loading button on form edit dan tambah data
- toast error api edit jabatan

No Issues
This commit is contained in:
2025-08-27 17:06:43 +08:00
parent bb242c9be8
commit d460653408
4 changed files with 17 additions and 11 deletions

View File

@@ -34,7 +34,7 @@ export default function Index() {
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
const [loading, setLoading] = useState(true)
const [status, setStatus] = useState<'true' | 'false'>('true')
const [loadingSubmit, setLoadingSubmit] = useState(false)
const [idChoose, setIdChoose] = useState('')
const [activeChoose, setActiveChoose] = useState(true)
const [titleChoose, setTitleChoose] = useState('')
@@ -49,12 +49,14 @@ export default function Index() {
async function handleEdit() {
try {
setLoadingSubmit(true)
const hasil = await decryptToken(String(token?.current))
const response = await apiEditGroup({ user: hasil, name: titleChoose }, idChoose)
dispatch(setUpdateGroup(!update))
} catch (error) {
console.error(error)
} finally {
setLoadingSubmit(false)
setVisibleEdit(false)
setModal(false)
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
@@ -234,7 +236,7 @@ export default function Index() {
onChange={(val) => { validationForm(val, 'title') }} />
</View>
<View>
<ButtonForm text="SIMPAN" disabled={Object.values(error).some((v) => v == true) || titleChoose == ""} onPress={() => { handleEdit() }} />
<ButtonForm text="SIMPAN" disabled={Object.values(error).some((v) => v == true) || titleChoose == "" || loadingSubmit} onPress={() => { handleEdit() }} />
</View>
</View>
</DrawerBottom>