Skip to content

Commit

Permalink
Merge pull request #116 from abes-esr/ITEM-218-appuyer-sur-entrer-fai…
Browse files Browse the repository at this point in the history
…t-planter-l'-EMAIL-premiere-connexion

Item 218 appuyer sur entrer fait planter l' email premiere connexion
  • Loading branch information
pierre-maraval authored Sep 17, 2024
2 parents fee4c02 + 92bd313 commit c9f5329
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions src/components/Email.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<span v-else>Modifier les informations de votre compte</span>
</v-card-title>
<v-card-text>
<v-form ref="form" class="pt-5">
<v-form
ref="form"
class="pt-5"
@submit.prevent="validate()">
<span>
Votre adresse mail est obligatoire pour utiliser l'application. Pour ajouter plusieurs adresses mail, séparez-les par des points virgules ;
</span>
Expand All @@ -17,7 +20,7 @@
id="email"
v-model="emailModel"
:rules="rules"
@keyup.enter="validate()">
>
</v-text-field>
</v-form>
<v-alert
Expand Down Expand Up @@ -80,25 +83,27 @@ onMounted(() => {
emailModel.value = props.email;
});
function validate() {
if(!props.email){
itemService.creerEmail(props.userId, emailModel.value)
.then(result => {
emits('validate', result.data.email);
})
.catch(err => {
messageError.value = err.response.data.message;
throw err;
});
} else {
itemService.modifierEmail(props.userId, emailModel.value)
.then(result => {
emits('validate', result.data.email);
})
.catch(err => {
messageError.value = err.response.data.message;
throw err;
});
async function validate() {
if(!isDisabled.value) {
if (!props.email) {
itemService.creerEmail(props.userId, emailModel.value)
.then(result => {
emits('validate', result.data.email);
})
.catch(err => {
messageError.value = err.response.data.message;
throw err;
});
} else {
itemService.modifierEmail(props.userId, emailModel.value)
.then(result => {
emits('validate', result.data.email);
})
.catch(err => {
messageError.value = err.response.data.message;
throw err;
});
}
}
}
</script>

0 comments on commit c9f5329

Please sign in to comment.