mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-27 11:11:50 +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 {
|
||||
const response = await http.post('/user/login', data);
|
||||
|
||||
http.defaults.headers.common['Authorization'] = response.data.token;
|
||||
await dispatch('setBasicData', response.data );
|
||||
if (response.status === 200){
|
||||
http.defaults.headers.common['Authorization'] = response.data.token;
|
||||
await dispatch('setBasicData', response.data );
|
||||
|
||||
delete response.data.token;
|
||||
delete response.data.roles;
|
||||
delete response.data.token;
|
||||
delete response.data.roles;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -65,15 +65,17 @@ export default (props, { $f7, $on, $update, $f7router }) => {
|
||||
};
|
||||
|
||||
const result = await user.dispatch('logIn', data);
|
||||
$f7.preloader.hide();
|
||||
|
||||
if (result.status === 200){
|
||||
$f7router.navigate('/');
|
||||
$f7.toast.show( { text: "Ha iniciado sesión." });
|
||||
}
|
||||
else{
|
||||
$f7.toast.show( { text: result.message });
|
||||
if (result.status !== undefined && result.status !== 200){
|
||||
$f7.toast.show( { text: result.data.messages.error } );
|
||||
$f7.preloader.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
$f7.preloader.hide();
|
||||
$f7router.navigate('/');
|
||||
$f7.toast.show( { text: "Ha iniciado sesión." });
|
||||
|
||||
}
|
||||
catch (error) {
|
||||
$f7.preloader.hide();
|
||||
|
Loading…
Reference in New Issue
Block a user