Skip to content
Snippets Groups Projects
Commit 1b98fdbd authored by Martin Weise's avatar Martin Weise
Browse files

Merge branch '122-test-amqp' of...

Merge branch '122-test-amqp' of gitlab.phaidra.org:fair-data-austria-db-repository/fda-services into 122-test-amqp


Former-commit-id: a90426ec
parents 30df0bf3 66ee3f37
Branches
Tags
1 merge request!42Fixed the query service tests
......@@ -42,6 +42,7 @@
to="/signup">
<v-icon left>mdi-account-plus</v-icon> Signup
</v-btn>
{{ username }}
<v-menu bottom offset-y left>
<template v-slot:activator="{ on, attrs }">
<v-btn
......@@ -62,6 +63,10 @@
@click="switchTheme()">
{{ nextTheme }} Theme
</v-list-item>
<v-list-item
@click="logout">
Logout
</v-list-item>
</v-list>
</v-menu>
</v-app-bar>
......@@ -150,6 +155,9 @@ export default {
token () {
return this.$store.state.token
},
username () {
return this.$store.state.user && this.$store.state.user.username
},
nextTheme () {
return this.$vuetify.theme.dark ? 'Light' : 'Dark'
},
......@@ -178,6 +186,12 @@ export default {
switchTheme () {
this.$vuetify.theme.dark = !this.$vuetify.theme.dark
},
logout () {
this.$store.commit('SET_TOKEN', null)
this.$store.commit('SET_USER', null)
this.$toast.success('Logged out')
this.$router.push('/container')
},
async loadDB () {
if (this.$route.params.db_id && !this.db) {
try {
......
......@@ -55,7 +55,8 @@ export default {
plugins: [
{ src: '~/plugins/toast', ssr: false },
{ src: '~/plugins/vendors', ssr: false },
{ src: '~/plugins/axios' }
{ src: '~/plugins/axios' },
{ src: '~/plugins/vuex-persist.js', mode: 'client' }
],
// Auto import components (https://go.nuxtjs.dev/config-components)
......
......@@ -86,6 +86,9 @@ export default {
const res = await this.$axios.post(url, this.loginAccount)
console.debug('login user', res.data)
this.$store.commit('SET_TOKEN', res.data.token)
const user = { ...res.data }
delete user.token
this.$store.commit('SET_USER', user)
this.$toast.success('Welcome back!')
this.$router.push('/container')
} catch (err) {
......
import VuexPersistence from 'vuex-persist'
export default ({ store }) => {
new VuexPersistence({
storage: window.localStorage,
reducer: state => ({
token: state.token,
user: state.user
})
}).plugin(store)
}
export const state = () => ({
db: null,
token: null
token: null,
user: null
})
export const mutations = {
......@@ -9,5 +10,8 @@ export const mutations = {
},
SET_TOKEN (state, token) {
state.token = token
},
SET_USER (state, user) {
state.user = user
}
}
......@@ -12144,7 +12144,7 @@ vuetify@^2.5.3:
vuex-persist@^3.1.3:
version "3.1.3"
resolved "https://registry.npmjs.org/vuex-persist/-/vuex-persist-3.1.3.tgz"
resolved "https://registry.yarnpkg.com/vuex-persist/-/vuex-persist-3.1.3.tgz#518c722a2ca3026bcee5732f99d24f75cee0f3b6"
integrity sha512-QWOpP4SxmJDC5Y1+0+Yl/F4n7z27syd1St/oP+IYCGe0X0GFio0Zan6kngZFufdIhJm+5dFGDo3VG5kdkCGeRQ==
dependencies:
deepmerge "^4.2.2"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment