auth.nuxt.js plugin
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
<template lang='pug'>
|
||||
b-modal(hide-footer @hidden='$router.replace("/")' ref='modal'
|
||||
:title="$t('Register')" :visible='true' @shown='$refs.email.focus()')
|
||||
:title="$t('common.register')" :visible='true' @shown='$refs.email.focus()')
|
||||
el-form
|
||||
p(v-html="$t('register_explanation')")
|
||||
p(v-html="$t('register.description')")
|
||||
el-input.mb-2(ref='email' v-model='user.email' type='email'
|
||||
:placeholder='$t("Email")' autocomplete='email')
|
||||
:placeholder='$t("common.email")' autocomplete='email')
|
||||
span(slot='prepend') @
|
||||
|
||||
el-input.mb-2(v-model='user.password' type="password" placeholder="Password")
|
||||
v-icon(name='lock' slot='prepend')
|
||||
|
||||
el-input.mb-2(v-model='user.description' type="textarea" rows='3' :placeholder="$t('Description')")
|
||||
el-input.mb-2(v-model='user.description' type="textarea" rows='3' :placeholder="$t('common.description')")
|
||||
v-icon(name='envelope-open-text')
|
||||
|
||||
el-button.float-right(plain type="success" icon='el-icon-arrow-right' @click='register') {{$t('Send')}}
|
||||
el-button.float-right(plain type="success" icon='el-icon-arrow-right' @click='register') {{$t('common.send')}}
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -33,23 +33,15 @@ export default {
|
||||
...mapActions(['login']),
|
||||
async register () {
|
||||
try {
|
||||
const user = await this.$axios.$post('/user', this.user) //api.register(this.user)
|
||||
console.log(user)
|
||||
if (!user.is_admin) {
|
||||
this.$refs.modal.hide()
|
||||
Message({
|
||||
message: this.$t('registration_complete'),
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
Message({
|
||||
message: this.$t('admin_registration_complete'),
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
const user = await this.$axios.$post('/user', this.user)
|
||||
this.$refs.modal.hide()
|
||||
Message({
|
||||
message: this.$t(`register.${user.is_admin && 'admin_'}complete`),
|
||||
type: 'success'
|
||||
})
|
||||
} catch (e) {
|
||||
Message({
|
||||
message: e,
|
||||
message: this.$t('register.error') + e,
|
||||
type: 'error'
|
||||
})
|
||||
console.error(e)
|
||||
|
||||
Reference in New Issue
Block a user