mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 10:39:18 +01:00
Updates:
-Fix login user data message error.
This commit is contained in:
parent
315b35c3fe
commit
fe4d913190
@ -48,11 +48,13 @@ const user = createStore({
|
|||||||
try {
|
try {
|
||||||
const response = await http.post('/user/login', data);
|
const response = await http.post('/user/login', data);
|
||||||
|
|
||||||
http.defaults.headers.common['Authorization'] = response.data.token;
|
if (response.status === 200){
|
||||||
await dispatch('setBasicData', response.data );
|
http.defaults.headers.common['Authorization'] = response.data.token;
|
||||||
|
await dispatch('setBasicData', response.data );
|
||||||
|
|
||||||
delete response.data.token;
|
delete response.data.token;
|
||||||
delete response.data.roles;
|
delete response.data.roles;
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
@ -65,15 +65,17 @@ export default (props, { $f7, $on, $update, $f7router }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const result = await user.dispatch('logIn', data);
|
const result = await user.dispatch('logIn', data);
|
||||||
$f7.preloader.hide();
|
|
||||||
|
|
||||||
if (result.status === 200){
|
if (result.status !== undefined && result.status !== 200){
|
||||||
$f7router.navigate('/');
|
$f7.toast.show( { text: result.data.messages.error } );
|
||||||
$f7.toast.show( { text: "Ha iniciado sesión." });
|
$f7.preloader.hide();
|
||||||
}
|
return;
|
||||||
else{
|
|
||||||
$f7.toast.show( { text: result.message });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$f7.preloader.hide();
|
||||||
|
$f7router.navigate('/');
|
||||||
|
$f7.toast.show( { text: "Ha iniciado sesión." });
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
$f7.preloader.hide();
|
$f7.preloader.hide();
|
||||||
|
Loading…
Reference in New Issue
Block a user