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 Vue.config.productionTip = false
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth && !store.state.session_id) { if (to.meta.requiresAuth && !store.state.sessionId) {
next({ path: '/login' }) next({ path: '/login' })
} else { } else {
next() next()

View File

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

View File

@ -36,17 +36,17 @@ describe('Vuex store', () => {
const state = {} const state = {}
it('calls two commits', () => { 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) expect(commit).toHaveBeenCalledTimes(2)
}) })
it('commits sessionId', () => { 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) expect(commit).toHaveBeenNthCalledWith(1, 'sessionId', 1234)
}) })
it('commits email', () => { 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') expect(commit).toHaveBeenNthCalledWith(2, 'email', 'someone@there.is')
}) })
}) })

View File

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

View File

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

View File

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

View File

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

View File

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