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