Cleanup code & make sure it has a common code style
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import {HTTP} from '../../http-common'
|
||||
import {ERROR_MESSAGE, LOADING} from "../mutation-types";
|
||||
import UserModel from "../../models/user";
|
||||
import {HTTP} from '@/http-common'
|
||||
import {ERROR_MESSAGE, LOADING} from '../mutation-types'
|
||||
import UserModel from '../../models/user'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
@ -37,12 +37,12 @@ export default {
|
||||
// Delete an eventually preexisting old token
|
||||
localStorage.removeItem('token')
|
||||
|
||||
const data = {
|
||||
const data = {
|
||||
username: credentials.username,
|
||||
password: credentials.password
|
||||
password: credentials.password,
|
||||
}
|
||||
|
||||
if(credentials.totpPasscode) {
|
||||
if (credentials.totpPasscode) {
|
||||
data.totp_passcode = credentials.totpPasscode
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ export default {
|
||||
return HTTP.post('register', {
|
||||
username: credentials.username,
|
||||
email: credentials.email,
|
||||
password: credentials.password
|
||||
password: credentials.password,
|
||||
})
|
||||
.then(() => {
|
||||
return ctx.dispatch('login', credentials)
|
||||
@ -135,7 +135,7 @@ export default {
|
||||
HTTP.post('user/token', null, {
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + localStorage.getItem('token'),
|
||||
}
|
||||
},
|
||||
})
|
||||
.then(r => {
|
||||
localStorage.setItem('token', r.data.token)
|
||||
@ -149,6 +149,6 @@ export default {
|
||||
logout(ctx) {
|
||||
localStorage.removeItem('token')
|
||||
ctx.dispatch('checkAuth')
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import {CONFIG} from '../mutation-types'
|
||||
import {HTTP} from '../../http-common'
|
||||
import {HTTP} from '@/http-common'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
@ -18,7 +18,7 @@ export default {
|
||||
legal: {
|
||||
imprintUrl: '',
|
||||
privacyPolicyUrl: '',
|
||||
}
|
||||
},
|
||||
}),
|
||||
mutations: {
|
||||
[CONFIG](state, config) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
import BucketService from '../../services/bucket'
|
||||
import {filterObject} from '../../helpers/filterObject'
|
||||
import {filterObject} from '@/helpers/filterObject'
|
||||
import {setLoading} from '../helper'
|
||||
|
||||
/**
|
||||
@ -90,7 +90,7 @@ export default {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
getTaskById: state => id => {
|
||||
|
@ -16,7 +16,7 @@ export default {
|
||||
},
|
||||
getters: {
|
||||
getListById: state => id => {
|
||||
if(typeof state[id] !== 'undefined') {
|
||||
if (typeof state[id] !== 'undefined') {
|
||||
return state[id]
|
||||
}
|
||||
return null
|
||||
|
@ -95,7 +95,7 @@ export default {
|
||||
},
|
||||
loadNamespacesIfFavoritesDontExist(ctx) {
|
||||
// The first namespace should be the one holding all favorites
|
||||
if(ctx.state.namespaces[0].id !== -2) {
|
||||
if (ctx.state.namespaces[0].id !== -2) {
|
||||
return ctx.dispatch('loadNamespaces')
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user