mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-06 06:48:21 +00:00
Fixed logout event issue on editor (#6019)
This commit is contained in:
parent
8e65eabb70
commit
b82c4c7044
2 changed files with 16 additions and 13 deletions
|
|
@ -344,8 +344,7 @@ function showModal(_ref, modal, show) {
|
|||
|
||||
function logoutAction(_ref) {
|
||||
localStorage.clear();
|
||||
_ref.props.navigate('/login');
|
||||
window.location.href = '/login';
|
||||
authenticationService.logout(true);
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ function resetPassword(params) {
|
|||
return fetch(`${config.apiUrl}/reset-password`, requestOptions).then(handleResponse);
|
||||
}
|
||||
|
||||
function logout() {
|
||||
function logout(avoidRedirection = false) {
|
||||
const requestOptions = {
|
||||
method: 'GET',
|
||||
headers: authHeader(),
|
||||
|
|
@ -242,16 +242,20 @@ function logout() {
|
|||
.then(handleResponseWithoutValidation)
|
||||
.then(() => {
|
||||
const loginPath = (window.public_config?.SUB_PATH || '/') + 'login';
|
||||
const pathname = window.public_config?.SUB_PATH
|
||||
? window.location.pathname.replace(window.public_config?.SUB_PATH, '')
|
||||
: window.location.pathname;
|
||||
window.location.href =
|
||||
loginPath +
|
||||
`?redirectTo=${
|
||||
!pathname.includes('integrations')
|
||||
? excludeWorkspaceIdFromURL(pathname)
|
||||
: `${pathname.indexOf('/') === 0 ? '' : '/'}${pathname}`
|
||||
}`;
|
||||
if (avoidRedirection) {
|
||||
window.location.href = loginPath;
|
||||
} else {
|
||||
const pathname = window.public_config?.SUB_PATH
|
||||
? window.location.pathname.replace(window.public_config?.SUB_PATH, '')
|
||||
: window.location.pathname;
|
||||
window.location.href =
|
||||
loginPath +
|
||||
`?redirectTo=${
|
||||
!pathname.includes('integrations')
|
||||
? excludeWorkspaceIdFromURL(pathname)
|
||||
: `${pathname.indexOf('/') === 0 ? '' : '/'}${pathname}`
|
||||
}`;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
authenticationService.updateCurrentSession({
|
||||
|
|
|
|||
Loading…
Reference in a new issue