[DEV-369] Fix check session or logout

This commit is contained in:
Maxi Redigonda 2022-06-03 19:12:03 -03:00
parent 40016635a8
commit fa838b3c44
3 changed files with 4 additions and 6 deletions

View File

@ -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];

View File

@ -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);
} }

View File

@ -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)