Skip to content

Commit

Permalink
Atualiza página de cadastro
Browse files Browse the repository at this point in the history
  • Loading branch information
lubien committed May 18, 2019
1 parent d7bd520 commit 5ce7ebf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
14 changes: 3 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions pages/signup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
<h3 class="title has-text-white">Cadastro de Usuário</h3>
<div class="box">
<form>
<b-field label="Nome">
<b-input v-model="name"></b-input>
</b-field>

<b-field label="Email">
<b-input v-model="email" type="email" maxlength="30"> </b-input>
<b-input v-model="email" type="email"> </b-input>
</b-field>

<b-field label="Nome de usuário">
Expand All @@ -25,8 +21,8 @@
</b-field>
<b-field label="Tipo usuário">
<b-select placeholder="Selecione um tipo usuário" required expaned>
<option value="flint">Administrador</option>
<option value="silver">Professor</option>
<option value="admin">Administrador</option>
<option value="teacher">Professor</option>
</b-select>
</b-field>
<button
Expand All @@ -47,7 +43,7 @@ export default {
name: 'Signup',
data() {
return {
name: '',
username: '',
password: '',
email: '',
role: ''
Expand All @@ -58,7 +54,7 @@ export default {
try {
await this.$store.dispatch('auth/register', {
email: this.email,
name: this.name,
username: this.username,
password: this.password,
role: this.role
})
Expand Down
8 changes: 2 additions & 6 deletions store/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ export const actions = {
})
},

register({ commit, dispatch }, { email, name, password }) {
return this.$axios
.$post('/api/users', { email, name, password })
.then(user => {
return dispatch('login', { email, password })
})
register({ commit, dispatch }, { email, username, password, role }) {
return this.$axios.$post('/api/users', { email, username, password, role })
},

logout({ commit }) {
Expand Down

0 comments on commit 5ce7ebf

Please sign in to comment.