Désactivation de boutons pendant les requêtes

This commit is contained in:
Emmy D'Anello 2024-12-14 12:55:55 +01:00
parent 9c6dc97d23
commit 601b337369
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -179,13 +179,13 @@ export default function ChallengesList() {
inputMode='numeric'
onChangeText={(text) => setEditChallengeReward(+text)}
error={!editChallengeReward}
onEndEditing={sendEditChallenge} />
onEndEditing={() => !addChallengeMutation.isPending && editChallengeMutation.isPending && sendEditChallenge()} />
</Dialog.Content>
<Dialog.Actions>
<Button onPress={() => setEditChallengeVisible(false)}>Annuler</Button>
<Button
onPress={sendEditChallenge}
disabled={!editChallengeTitle || !editChallengeDescription || !editChallengeReward}>
disabled={!editChallengeTitle || !editChallengeDescription || !editChallengeReward || addChallengeMutation.isPending || editChallengeMutation.isPending}>
{editChallengeId ? "Modifier" : "Ajouter"}
</Button>
</Dialog.Actions>
@ -199,7 +199,7 @@ export default function ChallengesList() {
</Dialog.Content>
<Dialog.Actions>
<Button onPress={() => setConfirmDeleteVisible(false)}>Annuler</Button>
<Button onPress={sendDeleteChallenge}>Confirmer</Button>
<Button onPress={sendDeleteChallenge} disabled={deleteChallengeMutation.isPending}>Confirmer</Button>
</Dialog.Actions>
</Dialog>
</Portal>