2020-10-16 06:45:40 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
2020-11-24 17:42:43 +00:00
|
|
|
<q-page padding class="fit row justify-center content-center items-center q-gutter-sm">
|
2020-11-06 00:17:04 +00:00
|
|
|
<q-card class="col-12">
|
2020-11-24 17:42:43 +00:00
|
|
|
<q-card-section class="fit row justify-start content-center items-center">
|
2020-11-06 00:17:04 +00:00
|
|
|
<div class="col-12 text-center text-h6">Benutzereinstellungen</div>
|
|
|
|
</q-card-section>
|
2020-11-12 21:48:19 +00:00
|
|
|
<MainUserSettings :user="currentUser" @update:user="updateUser" />
|
2020-11-06 00:17:04 +00:00
|
|
|
</q-card>
|
|
|
|
<div class="col-12 text-left text-h6">Aktive Sessions:</div>
|
2020-11-24 17:42:43 +00:00
|
|
|
<sessions v-for="(session, index) in sessions" :key="'session' + index" :session="session" />
|
2020-10-16 06:45:40 +00:00
|
|
|
</q-page>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-01-30 03:16:17 +00:00
|
|
|
import { computed, defineComponent, onBeforeMount, ref } from 'vue';
|
2020-10-19 11:59:56 +00:00
|
|
|
import Sessions from '../components/settings/Sessions.vue';
|
2020-11-06 00:17:04 +00:00
|
|
|
import MainUserSettings from '../components/settings/MainUserSettings.vue';
|
2020-10-29 00:39:06 +00:00
|
|
|
import { Store } from 'vuex';
|
|
|
|
import { StateInterface } from 'src/store';
|
2020-11-24 17:42:43 +00:00
|
|
|
import setLoadingBar from 'src/utils/loading';
|
2020-10-29 00:39:06 +00:00
|
|
|
|
2020-10-16 06:45:40 +00:00
|
|
|
export default defineComponent({
|
|
|
|
// name: 'PageName'
|
2020-11-24 17:42:43 +00:00
|
|
|
components: { Sessions, MainUserSettings },
|
2021-01-30 03:16:17 +00:00
|
|
|
setup(_, _, {
|
2020-10-29 00:39:06 +00:00
|
|
|
const store = <Store<StateInterface>>root.$store;
|
|
|
|
|
2020-10-16 11:07:31 +00:00
|
|
|
onBeforeMount(() => {
|
2021-03-18 16:23:57 +00:00
|
|
|
store.dispatch('session/getSessions').catch((error) => {
|
2020-10-28 23:12:46 +00:00
|
|
|
console.warn(error);
|
|
|
|
});
|
2020-10-16 11:07:31 +00:00
|
|
|
});
|
2020-10-16 11:54:01 +00:00
|
|
|
|
2020-11-06 00:17:04 +00:00
|
|
|
const currentUser = ref(<FG.User>store.state.user.currentUser);
|
|
|
|
const sessions = computed(() => store.state.session.sessions);
|
2021-01-27 07:16:44 +00:00
|
|
|
const loading = computed(() => store.state.session.loading || store.state.user.loading > 0);
|
2020-11-12 21:48:19 +00:00
|
|
|
function updateUser(value: FG.User) {
|
2021-03-18 16:23:57 +00:00
|
|
|
store.dispatch('user/updateUser', value).catch((error) => {
|
2020-11-12 21:48:19 +00:00
|
|
|
console.warn(error);
|
|
|
|
});
|
|
|
|
}
|
2020-10-16 11:54:01 +00:00
|
|
|
|
2020-11-15 13:18:28 +00:00
|
|
|
setLoadingBar(loading);
|
|
|
|
|
2020-10-16 11:07:31 +00:00
|
|
|
return {
|
2020-11-06 00:17:04 +00:00
|
|
|
currentUser,
|
2020-11-12 21:48:19 +00:00
|
|
|
sessions,
|
2021-03-18 16:23:57 +00:00
|
|
|
updateUser,
|
2020-10-16 11:07:31 +00:00
|
|
|
};
|
2021-03-18 16:23:57 +00:00
|
|
|
},
|
2020-10-16 06:45:40 +00:00
|
|
|
});
|
|
|
|
</script>
|