mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
login expects JWT
This commit is contained in:
parent
088f61c6ac
commit
7610ad08b6
@ -72,6 +72,7 @@
|
||||
"vue-good-table": "^2.21.3",
|
||||
"vue-i18n": "^8.22.4",
|
||||
"vue-jest": "^3.0.7",
|
||||
"vue-jwt-decode": "^0.1.0",
|
||||
"vue-loading-overlay": "^3.4.2",
|
||||
"vue-moment": "^4.1.0",
|
||||
"vue-qrcode": "^0.3.5",
|
||||
|
||||
@ -2,17 +2,7 @@ import gql from 'graphql-tag'
|
||||
|
||||
export const login = gql`
|
||||
query($email: String!, $password: String!) {
|
||||
login(email: $email, password: $password) {
|
||||
sessionId
|
||||
user {
|
||||
email
|
||||
firstName
|
||||
lastName
|
||||
language
|
||||
username
|
||||
description
|
||||
}
|
||||
}
|
||||
login(email: $email, password: $password)
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import createPersistedState from 'vuex-persistedstate'
|
||||
import VueJwtDecode from 'vue-jwt-decode'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export const mutations = {
|
||||
@ -25,17 +27,22 @@ export const mutations = {
|
||||
description: (state, description) => {
|
||||
state.description = description
|
||||
},
|
||||
token: (state, token) => {
|
||||
state.token = token
|
||||
},
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
login: ({ dispatch, commit }, data) => {
|
||||
commit('sessionId', data.sessionId)
|
||||
commit('email', data.user.email)
|
||||
commit('language', data.user.language)
|
||||
commit('username', data.user.username)
|
||||
commit('firstName', data.user.firstName)
|
||||
commit('lastName', data.user.lastName)
|
||||
commit('description', data.user.description)
|
||||
login: ({ dispatch, commit }, token) => {
|
||||
const decoded = VueJwtDecode.decode(token)
|
||||
commit('sessionId', decoded.sessionId)
|
||||
commit('email', decoded.email)
|
||||
commit('language', decoded.language)
|
||||
commit('username', decoded.username)
|
||||
commit('firstName', decoded.firstName)
|
||||
commit('lastName', decoded.lastName)
|
||||
commit('description', decoded.description)
|
||||
commit('token', token)
|
||||
},
|
||||
logout: ({ commit, state }) => {
|
||||
commit('sessionId', null)
|
||||
|
||||
@ -107,6 +107,7 @@ export default {
|
||||
},
|
||||
async updateTransactions(pagination) {
|
||||
this.pending = true
|
||||
console.log('Session ID', this.$store.state.sessionId)
|
||||
this.$apollo
|
||||
.query({
|
||||
query: transactionsQuery,
|
||||
@ -118,9 +119,11 @@ export default {
|
||||
fetchPolicy: 'network-only',
|
||||
})
|
||||
.then((result) => {
|
||||
console.log(result)
|
||||
const {
|
||||
data: { transactionList },
|
||||
} = result
|
||||
console.log(transactionList)
|
||||
this.GdtBalance = Number(transactionList.gdtSum)
|
||||
this.transactions = transactionList.transactions
|
||||
this.balance = Number(transactionList.decay)
|
||||
|
||||
@ -13576,6 +13576,13 @@ vue-jest@^3.0.5, vue-jest@^3.0.7:
|
||||
tsconfig "^7.0.0"
|
||||
vue-template-es2015-compiler "^1.6.0"
|
||||
|
||||
vue-jwt-decode@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/vue-jwt-decode/-/vue-jwt-decode-0.1.0.tgz#f9caf7b9030d5459cc567b1c3117d9d1f291458f"
|
||||
integrity sha512-4iP0NzYHkAF7G13tYPc/nudk4oNpB8GCVZupc7lekxXok1XKEgefNaGTpDT14g7RKe5H9GaMphPduDj4UVfZwQ==
|
||||
dependencies:
|
||||
vue "^2.3.3"
|
||||
|
||||
vue-loader@^15.7.0:
|
||||
version "15.9.6"
|
||||
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.9.6.tgz#f4bb9ae20c3a8370af3ecf09b8126d38ffdb6b8b"
|
||||
@ -13655,6 +13662,11 @@ vue@^2.2.6, vue@^2.5.17, vue@^2.6.11:
|
||||
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.12.tgz#f5ebd4fa6bd2869403e29a896aed4904456c9123"
|
||||
integrity sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==
|
||||
|
||||
vue@^2.3.3:
|
||||
version "2.6.14"
|
||||
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235"
|
||||
integrity sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==
|
||||
|
||||
vuex-persistedstate@^4.0.0-beta.3:
|
||||
version "4.0.0-beta.3"
|
||||
resolved "https://registry.yarnpkg.com/vuex-persistedstate/-/vuex-persistedstate-4.0.0-beta.3.tgz#89dd712de72d28e85cc95467d066002c1405f277"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user