+
@@ -357,6 +359,15 @@ export default {
' hinzugefügt.'
}
return text
+ },
+ calcLastSeen(user) {
+ if (user.last_seen) {
+ let date = new Date()
+ if (((date - user.last_seen)/1000/60/60) < 72) {
+ return true
+ }
+ }
+ return false
}
},
computed: {
diff --git a/src/plugins/routes.js b/src/plugins/routes.js
index 8aab36d..0e716ce 100644
--- a/src/plugins/routes.js
+++ b/src/plugins/routes.js
@@ -1,6 +1,6 @@
//const main = 'https://192.168.5.128:5000/'
-//const main = 'http://localhost:5000/'
-const main = 'http://192.168.5.118:5000/'
+const main = 'http://localhost:5000/'
+//const main = 'http://192.168.5.118:5000/'
//const main = 'https://groeger-clan.duckdns.org:5000/'
const url = {
diff --git a/src/store/modules/barUsers.js b/src/store/modules/barUsers.js
index 92e7788..8365e25 100644
--- a/src/store/modules/barUsers.js
+++ b/src/store/modules/barUsers.js
@@ -28,7 +28,9 @@ const mutations = {
let existuser = state.users.find(a => {
return user === a.username
})
-
+ if (users[user].last_seen != null || users[user].last_seen != undefined) {
+ users[user].last_seen = new Date(users[user].last_seen.year, users[user].last_seen.month -1, users[user].last_seen.day, users[user].last_seen.hour, users[user].last_seen.minute, users[user].last_seen.second)
+ }
if (existuser) {
existuser.sername = users[user].username
existuser.firstname = users[user].firstname
@@ -37,6 +39,7 @@ const mutations = {
existuser.amount = users[user].amount
existuser.type = users[user].type
existuser.limit = users[user].limit
+ existuser.last_seen = users[user].last_seen
} else {
state.users.push({
username: users[user].username,
@@ -46,7 +49,8 @@ const mutations = {
amount: users[user].amount,
type: users[user].type,
loading: false,
- limit: users[user].limit
+ limit: users[user].limit,
+ last_seen: users[user].last_seen
})
}
}
@@ -59,6 +63,8 @@ const mutations = {
})
)
if (data.loading !== undefined) state.users[index].loading = data.loading
+ if (data.last_seen !== undefined) state.users[index].last_seen = data.last_seen
+ console.log('user', state.users[index])
},
sortUsers: state => {
state.users = state.users.sort((a, b) => {
@@ -206,7 +212,7 @@ const actions = {
}
}
try {
- commit('updateUser', { username: data.username, loading: false })
+ commit('updateUser', { username: data.username, loading: false, last_seen: new Date() })
} catch {
// error
}