fix #73 - add migration to docs

This commit is contained in:
les
2020-02-15 15:42:41 +01:00
parent 1ef78c5f4d
commit e6f9db2f3a
7 changed files with 36 additions and 16 deletions

View File

@@ -21,6 +21,7 @@
import { mapState } from 'vuex'
import { Message } from 'element-ui'
import get from 'lodash/get'
import linkify from 'linkifyjs'
export default {
name: 'Register',
@@ -46,19 +47,21 @@ export default {
this.$refs.email.focus()
},
methods: {
close () {
this.$router.replace('/')
},
async register () {
this.loading = true
try {
await this.$axios.$post('/user/register', this.user)
if (!linkify.test(this.user.email, 'email')) {
throw new Error('Invalid email')
}
this.loading = true
const user = await this.$axios.$post('/user/register', this.user)
// this is the first user registered
const first_user = user && user.is_admin && user.is_active
Message({
showClose: true,
message: this.$t('register.complete'),
message: first_user ? this.$t('register.first_user') : this.$t('register.complete'),
type: 'success'
})
this.close()
this.$router.replace('/')
} catch (e) {
const error = get(e, 'response.data.errors[0].message', String(e))
Message({