all session_id are sessionId now

This commit is contained in:
Moriz Wahl 2021-05-10 11:57:45 +02:00
parent d427ddfd8e
commit d70241e4d2
8 changed files with 13 additions and 13 deletions

View File

@ -14,7 +14,7 @@ Vue.use(DashboardPlugin)
Vue.config.productionTip = false
router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth && !store.state.session_id) {
if (to.meta.requiresAuth && !store.state.sessionId) {
next({ path: '/login' })
} else {
next()

View File

@ -17,7 +17,7 @@ export const mutations = {
export const actions = {
login: ({ dispatch, commit }, data) => {
commit('sessionId', data.session_id)
commit('sessionId', data.sessionId)
commit('email', data.email)
},
logout: ({ commit, state }) => {

View File

@ -36,17 +36,17 @@ describe('Vuex store', () => {
const state = {}
it('calls two commits', () => {
login({ commit, state }, { session_id: 1234, email: 'someone@there.is' })
login({ commit, state }, { sessionId: 1234, email: 'someone@there.is' })
expect(commit).toHaveBeenCalledTimes(2)
})
it('commits sessionId', () => {
login({ commit, state }, { session_id: 1234, email: 'someone@there.is' })
login({ commit, state }, { sessionId: 1234, email: 'someone@there.is' })
expect(commit).toHaveBeenNthCalledWith(1, 'sessionId', 1234)
})
it('commits email', () => {
login({ commit, state }, { session_id: 1234, email: 'someone@there.is' })
login({ commit, state }, { sessionId: 1234, email: 'someone@there.is' })
expect(commit).toHaveBeenNthCalledWith(2, 'email', 'someone@there.is')
})
})

View File

@ -93,13 +93,13 @@ export default {
}
},
async logout() {
await loginAPI.logout(this.$store.state.session_id)
await loginAPI.logout(this.$store.state.sessionId)
// do we have to check success?
this.$store.dispatch('logout')
this.$router.push('/login')
},
async updateTransactions() {
const result = await communityAPI.transactions(this.$store.state.session_id)
const result = await communityAPI.transactions(this.$store.state.sessionId)
if (result.success) {
this.GdtBalance = Number(result.result.data.gdtSum)
this.transactions = result.result.data.transactions

View File

@ -252,7 +252,7 @@ export default {
},
async sendTransaction() {
const result = await communityAPI.send(
this.$store.state.session_id,
this.$store.state.sessionId,
this.ajaxCreateData.email,
this.ajaxCreateData.amount,
this.ajaxCreateData.memo,

View File

@ -118,7 +118,7 @@ export default {
const result = await loginAPI.login(this.model.email, this.model.password)
if (result.success) {
this.$store.dispatch('login', {
session_id: result.result.data.session_id,
sessionId: result.result.data.session_id,
email: this.model.email,
})
this.$router.push('/overview')

View File

@ -191,7 +191,7 @@ export default {
)
if (result.success) {
this.$store.dispatch('login', {
session_id: result.result.data.session_id,
sessionId: result.result.data.session_id,
email: this.model.email,
})
this.model.email = ''

View File

@ -104,7 +104,7 @@ export default {
passwordVisible: false,
submitted: false,
authenticated: false,
session_id: null,
sessionId: null,
email: null,
}
},
@ -113,7 +113,7 @@ export default {
this.passwordVisible = !this.passwordVisible
},
async onSubmit() {
const result = await loginAPI.changePassword(this.session_id, this.email, this.password)
const result = await loginAPI.changePassword(this.sessionId, this.email, this.password)
if (result.success) {
this.password = ''
this.$router.push('/thx')
@ -126,7 +126,7 @@ export default {
const result = await loginAPI.loginViaEmailVerificationCode(optin)
if (result.success) {
this.authenticated = true
this.session_id = result.result.data.session_id
this.sessionId = result.result.data.session_id
this.email = result.result.data.user.email
} else {
alert(result.result.message)