Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item 218 appuyer sur entrer fait planter l' email premiere connexion #116

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading