mirror of
https://github.com/opensupports/opensupports.git
synced 2025-09-26 03:18:55 +02:00
[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() {
|
render() {
|
||||||
console.log('State: ', this.state.rawForm);
|
|
||||||
|
|
||||||
const { name, level, profilePic, myAccount, staffId, staffList, userId } = this.props;
|
const { name, level, profilePic, myAccount, staffId, staffList, userId } = this.props;
|
||||||
const { message, tickets, loadingPicture, email } = this.state;
|
const { message, tickets, loadingPicture, email } = this.state;
|
||||||
const myData = _.filter(staffList, {id: `${staffId}`})[0];
|
const myData = _.filter(staffList, {id: `${staffId}`})[0];
|
||||||
|
@ -28,7 +28,6 @@ function processData(data, dataAsForm = false) {
|
|||||||
return newData;
|
return newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const randomString = (length) => {
|
const randomString = (length) => {
|
||||||
var result = "";
|
var result = "";
|
||||||
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
@ -38,6 +37,7 @@ const randomString = (length) => {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
call: function ({ path, data, plain, dataAsForm }) {
|
call: function ({ path, data, plain, dataAsForm }) {
|
||||||
const callId = randomString(3);
|
const callId = randomString(3);
|
||||||
@ -57,7 +57,7 @@ export default {
|
|||||||
resolve(result);
|
resolve(result);
|
||||||
} else if (reject) {
|
} else if (reject) {
|
||||||
if (status === "fail" && message === "NO_PERMISSION") {
|
if (status === "fail" && message === "NO_PERMISSION") {
|
||||||
expiredSessionUtils.checkSessionOrLogOut();
|
expiredSessionUtils.checkSessionOrLogOut(processData({}));
|
||||||
}
|
}
|
||||||
reject(result);
|
reject(result);
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ function onSessionExpired(result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
checkSessionOrLogOut() {
|
checkSessionOrLogOut(credentialsData) {
|
||||||
APIUtils.post(apiRoot + "/user/check-session", {}, {})
|
APIUtils.post(apiRoot + "/user/check-session", credentialsData, {})
|
||||||
.then(onSessionExpired)
|
.then(onSessionExpired)
|
||||||
.catch((err) =>
|
.catch((err) =>
|
||||||
console.error("An error ocurred when checking session: ", err)
|
console.error("An error ocurred when checking session: ", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user