Ivan - Fix session [skip ci]
This commit is contained in:
parent
7f1047b311
commit
a60f6e9cd9
|
@ -4,20 +4,36 @@ import sessionStore from 'lib-app/session-store';
|
|||
import store from 'app/store';
|
||||
|
||||
export default {
|
||||
|
||||
login(loginData) {
|
||||
return {
|
||||
type: 'LOGIN',
|
||||
payload: API.call({
|
||||
path: '/user/login',
|
||||
data: loginData
|
||||
}).then((result) => {
|
||||
store.dispatch(this.getUserData(result.data.userId, result.data.token, result.data.staff));
|
||||
|
||||
if(result.data.staff) {
|
||||
store.dispatch(AdminDataActions.retrieveCustomResponses());
|
||||
}
|
||||
payload: new Promise((resolve, reject) => {
|
||||
let loginCall = () => {
|
||||
API.call({
|
||||
path: '/user/login',
|
||||
data: loginData
|
||||
}).then((result) => {
|
||||
store.dispatch(this.getUserData(result.data.userId, result.data.token, result.data.staff));
|
||||
|
||||
return result;
|
||||
if(result.data.staff) {
|
||||
store.dispatch(AdminDataActions.retrieveCustomResponses());
|
||||
}
|
||||
|
||||
resolve(result);
|
||||
}).catch((result) => {
|
||||
if(result.message === 'SESSION_EXISTS') {
|
||||
API.call({
|
||||
path: '/user/logout',
|
||||
data: {}
|
||||
}).then(loginCall);
|
||||
} else {
|
||||
reject(result);
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
loginCall();
|
||||
})
|
||||
};
|
||||
},
|
||||
|
@ -93,7 +109,7 @@ export default {
|
|||
} else {
|
||||
store.dispatch(this.autoLogin());
|
||||
}
|
||||
} else {
|
||||
} else if(sessionStore.isLoggedIn()) {
|
||||
store.dispatch({
|
||||
type: 'SESSION_CHECKED'
|
||||
});
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.ticket-list__number {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.signup-widget {
|
||||
background-color: $very-light-grey;
|
||||
}
|
||||
|
|
|
@ -74,10 +74,10 @@ class SessionStore {
|
|||
supportedLanguages: JSON.parse(this.getItem('supportedLanguages')),
|
||||
layout: this.getItem('layout'),
|
||||
title: this.getItem('title'),
|
||||
registration: !!(this.getItem('registration') * 1),
|
||||
'user-system-enabled': !!(this.getItem('user-system-enabled') * 1),
|
||||
'allow-attachments': !!(this.getItem('allow-attachments') * 1),
|
||||
'maintenance-mode': !!(this.getItem('maintenance-mode') * 1)
|
||||
registration: (this.getItem('registration') * 1),
|
||||
'user-system-enabled': (this.getItem('user-system-enabled') * 1),
|
||||
'allow-attachments': (this.getItem('allow-attachments') * 1),
|
||||
'maintenance-mode': (this.getItem('maintenance-mode') * 1)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue