mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-28 19:51:50 +01:00
commit
6fa8f01f50
@ -38,12 +38,13 @@ const user = createStore({
|
||||
dispatch('auth_request');
|
||||
try {
|
||||
const response = await http.post('/user/login', data);
|
||||
const token = response.data.token;
|
||||
|
||||
http.defaults.headers.common['Authorization'] = response.data.token;
|
||||
await dispatch('setBasicData', response.data );
|
||||
|
||||
delete response.data.token;
|
||||
const user = response.data.user;
|
||||
const roles = response.data.roles; //[1, 4, 14]; //Owner, Customer, Seller, Deliverer
|
||||
http.defaults.headers.common['Authorization'] = token;
|
||||
await dispatch('setBasicData', { token, user, roles });
|
||||
delete response.data.roles;
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
dispatch('auth_error');
|
||||
|
Loading…
Reference in New Issue
Block a user