Clean code
This commit is contained in:
@@ -45,8 +45,7 @@ export default new Vuex.Store({
|
|||||||
sessionStorage.setItem('token', response.data.token);
|
sessionStorage.setItem('token', response.data.token);
|
||||||
commit('loginSuccess');
|
commit('loginSuccess');
|
||||||
commit('loading', false);
|
commit('loading', false);
|
||||||
return response.data.token;
|
}).catch((error) => {
|
||||||
}, (error) => {
|
|
||||||
commit('loginFailure');
|
commit('loginFailure');
|
||||||
commit('loading', false);
|
commit('loading', false);
|
||||||
throw error;
|
throw error;
|
||||||
@@ -61,7 +60,6 @@ export default new Vuex.Store({
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
sessionStorage.removeItem('token');
|
sessionStorage.removeItem('token');
|
||||||
commit('logout');
|
commit('logout');
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadCountries ({ commit }) {
|
loadCountries ({ commit }) {
|
||||||
@@ -69,7 +67,6 @@ export default new Vuex.Store({
|
|||||||
url: '/api/countries',
|
url: '/api/countries',
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
commit('setCountries', response.data);
|
commit('setCountries', response.data);
|
||||||
return response.data;
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -46,9 +46,8 @@
|
|||||||
this.$store.dispatch('login', {
|
this.$store.dispatch('login', {
|
||||||
email: this.email,
|
email: this.email,
|
||||||
password: this.password
|
password: this.password
|
||||||
}).then((token) => {
|
}).then(() => {
|
||||||
this.$router.push({ name: 'address' });
|
this.$router.push({ name: 'address' });
|
||||||
return token;
|
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.message = 'Der Login ist fehlgeschlagen :(';
|
this.message = 'Der Login ist fehlgeschlagen :(';
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user