+
+ There are currently no apps
+ Manage apps
+
+
diff --git a/src/pages/SelectUser.vue b/src/pages/SelectUser.vue
index a0db45a..4376ef0 100644
--- a/src/pages/SelectUser.vue
+++ b/src/pages/SelectUser.vue
@@ -116,7 +116,7 @@ export default {
this.$store.dispatch('app/setUser', this.selecteduser)
},
login () {
- let username = (this.show_usernames === true) ? this.selecteduser.username : this.username
+ const username = (this.show_usernames === true) ? this.selecteduser.username : this.username
this.$store.dispatch('app/login', {
username: username,
password: this.password
diff --git a/src/store/app/actions.js b/src/store/app/actions.js
index bf7b174..c14e3a8 100644
--- a/src/store/app/actions.js
+++ b/src/store/app/actions.js
@@ -3,9 +3,10 @@ import { Notify, Cookies, LocalStorage } from 'quasar'
export function ping (context) {
// console.log(Cookies.getAll())
+ // console.log('ping')
// console.log(process.env.BACKEND_LOCATION + 'ping')
// Check to see if we are in setup
- let setup = LocalStorage.getItem('heimdall_setup')
+ const setup = LocalStorage.getItem('heimdall_setup')
if (setup !== null) {
context.commit('ping', 'setup')
context.commit('step', setup)
@@ -27,7 +28,7 @@ export function ping (context) {
context.commit('setUser', response.data.result)
context.dispatch('tiles/getApps', null, { root: true })
}
- }).catch(function () {
+ }).catch(() => {
Notify.create({
type: 'negative',
message: `Could not connect to backend server. ` + process.env.BACKEND_LOCATION + 'ping',
@@ -41,7 +42,13 @@ export function ping (context) {
export async function setupUser (context, data) {
// console.log(data)
try {
- await axios.post(process.env.BACKEND_LOCATION + 'users', data)
+ data.level = 0
+ const saveuser = await axios.post(process.env.BACKEND_LOCATION + 'users', data)
+ console.log(saveuser)
+ await firelogin(context, {
+ username: data.username,
+ password: data.password
+ })
context.commit('step', 2)
} catch (e) {
// axios returned a non-200 response
@@ -50,42 +57,48 @@ export async function setupUser (context, data) {
export async function setDefaults (context, data) {
// const [ language, show_usernames ] = await Promise.all([
- await Promise.all([
+ /* await Promise.all([
axios.put(process.env.BACKEND_LOCATION + 'settings', data.language),
axios.put(process.env.BACKEND_LOCATION + 'settings', data.show_usernames)
- ])
+ ]) */
+ axios.put(process.env.BACKEND_LOCATION + 'settings', data)
context.commit('step', 3)
}
+export function setupComplete (context) {
+ LocalStorage.remove('heimdall_setup')
+ console.log('finish')
+ ping(context)
+}
+
export function setUser (context, user) {
// console.log(data)
context.commit('setUser', user)
}
-export function login (context, data) {
+export async function firelogin (context, data) {
+ const response = await axios.post(process.env.BACKEND_LOCATION + 'login', data)
+ // console.log(response.data)
+ Cookies.set('jwt', response.data.result.token, {
+ expires: 3600
+ })
+ return response
+}
+
+export async function login (context, data) {
// console.log(data)
- axios
- .post(process.env.BACKEND_LOCATION + 'login', data)
- .then((response) => {
- console.log(response.data)
- /* Cookies.remove('jwt', {
- expires: 3600
- }) */
- Cookies.set('jwt', response.data.result.token, {
- expires: 3600
- // httpOnly: true
- })
- // context.commit('step', 2)
- ping(context)
- }).catch(function () {
- Notify.create({
- type: 'negative',
- message: `Could not log in.`,
- progress: true,
- position: 'top',
- timeout: 1500
- })
+ try {
+ await firelogin(context, data)
+ ping(context)
+ } catch (e) {
+ Notify.create({
+ type: 'negative',
+ message: `Could not log in.`,
+ progress: true,
+ position: 'top',
+ timeout: 1500
})
+ }
}
export function logout (context) {
diff --git a/src/store/tiles/actions.js b/src/store/tiles/actions.js
index 48ace54..afbcb3d 100644
--- a/src/store/tiles/actions.js
+++ b/src/store/tiles/actions.js
@@ -13,8 +13,8 @@ export function getApps (context) {
}
export function getPossibleApps (context, force = false) {
- let key = 'heimdall.possibleapps'
- let possibleapps = LocalStorage.getItem(key)
+ const key = 'heimdall.possibleapps'
+ const possibleapps = LocalStorage.getItem(key)
// console.log(possibleapps)
if (possibleapps === null || force === true) {
axios