fix some css

This commit is contained in:
2020-03-28 12:04:27 +01:00
parent 80c5eb53b6
commit 53ad9586a2
12 changed files with 114 additions and 97 deletions

View File

@@ -23,7 +23,7 @@
:message="alertMessage"
class="mb-1"
/>
<form @submit.prevent="addMember">
<form @submit.prevent="addMember" class="mb-2">
<InputField
name="name"
type="text"
@@ -33,9 +33,9 @@
@update:field="form.name = $event"
/>
<InputField name="email" type="email" label="Adresse email du nouveau membre" placeholder="E-mail" :errors="errors" @update:field="form.email = $event" />
<button>Ajouter</button>
<button class="btn-primary">Ajouter</button>
</form>
<div>
<div class="mb-2">
<h2>Liste des utilisateurs</h2>
<ul>
<li v-if="loading">> Loading...</li>
@@ -79,31 +79,27 @@
})
},
mounted() {
if(authUser.data.attributes.is_admin) {
axios.get('/api/users')
.then(response => {
this.users = response.data.data
this.loading = false
})
.catch(error => {
this.loading = false
alert('Unable to fetch users.')
})
}
axios.get('/api/users')
.then(response => {
this.users = response.data.data
this.loading = false
})
.catch(error => {
this.loading = false
alert('Unable to fetch users.')
})
},
methods: {
addMember: function () {
if(authUser.data.attributes.is_admin && this.form.name.length >= 4 && this.form.email.length >= 12) {
if(this.form.name.length >= 4 && this.form.email.length >= 12) {
axios.post('/api/users', {name: this.form.name, email: this.form.email})
.then(res => {
console.log(res)
this.form.name = ''
this.form.email = ''
this.alertType = 'success'
this.alertMessage = `${res.data.data.attributes.name} a bien été créé`
})
.catch(errors => {
console.log(errors)
this.alertType = 'error'
this.alertMessage = 'L\'utilisateur n\'a pas été créé'
})