[DEV-369] Fix check session or logout
This commit is contained in:
parent
40016635a8
commit
fa838b3c44
|
@ -83,8 +83,6 @@ class StaffEditor extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
console.log('State: ', this.state.rawForm);
|
||||
|
||||
const { name, level, profilePic, myAccount, staffId, staffList, userId } = this.props;
|
||||
const { message, tickets, loadingPicture, email } = this.state;
|
||||
const myData = _.filter(staffList, {id: `${staffId}`})[0];
|
||||
|
|
|
@ -28,7 +28,6 @@ function processData(data, dataAsForm = false) {
|
|||
return newData;
|
||||
}
|
||||
|
||||
|
||||
const randomString = (length) => {
|
||||
var result = "";
|
||||
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
@ -38,6 +37,7 @@ const randomString = (length) => {
|
|||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
export default {
|
||||
call: function ({ path, data, plain, dataAsForm }) {
|
||||
const callId = randomString(3);
|
||||
|
@ -57,7 +57,7 @@ export default {
|
|||
resolve(result);
|
||||
} else if (reject) {
|
||||
if (status === "fail" && message === "NO_PERMISSION") {
|
||||
expiredSessionUtils.checkSessionOrLogOut();
|
||||
expiredSessionUtils.checkSessionOrLogOut(processData({}));
|
||||
}
|
||||
reject(result);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ function onSessionExpired(result) {
|
|||
}
|
||||
|
||||
export default {
|
||||
checkSessionOrLogOut() {
|
||||
APIUtils.post(apiRoot + "/user/check-session", {}, {})
|
||||
checkSessionOrLogOut(credentialsData) {
|
||||
APIUtils.post(apiRoot + "/user/check-session", credentialsData, {})
|
||||
.then(onSessionExpired)
|
||||
.catch((err) =>
|
||||
console.error("An error ocurred when checking session: ", err)
|
||||
|
|
Loading…
Reference in New Issue