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

@@ -17,9 +17,11 @@ export default function CreateDiscussionDivision() {
const { token, decryptToken } = useAuthSession()
const update = useSelector((state: any) => state.discussionUpdate)
const dispatch = useDispatch();
const [loading, setLoading] = useState(false)
async function handleCreate() {
try {
setLoading(true)
const hasil = await decryptToken(String(token?.current))
const response = await apiCreateDiscussion({ data: { user: hasil, desc, idDivision: id } })
if (response.success) {
@@ -32,6 +34,8 @@ export default function CreateDiscussionDivision() {
} catch (error) {
console.error(error)
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
} finally {
setLoading(false)
}
}
@@ -43,7 +47,7 @@ export default function CreateDiscussionDivision() {
headerTitle: 'Tambah Diskusi',
headerTitleAlign: 'center',
headerRight: () => <ButtonSaveHeader
disable={desc == ""}
disable={desc == "" || loading}
category="create"
onPress={() => {
handleCreate()