Skip to content

Commit

Permalink
Merge pull request #288 from FlowFuse/4524_fix-immersive-editor-logout
Browse files Browse the repository at this point in the history
intercept logout click and emit logout event when editor is embedded
  • Loading branch information
cstns authored Sep 23, 2024
2 parents ad84321 + 2ad04ec commit 44eb2a4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/theme/common/forge-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@
navigateTo(url)
})
}
const interceptLogOutClick = (url) => {
document.querySelector('#usermenu-item-logout')
.addEventListener('click', (e) => {
e.preventDefault()
e.stopPropagation()
if (context.shouldEmitInsteadOfRedirect) {
window.parent.postMessage({
type: 'logout'
}, '*')
}
})
}

function changeFavicon (src) {
const link = document.createElement('link')
Expand Down Expand Up @@ -102,7 +114,7 @@
}
})
}

interceptLogOutClick()
interceptLogoClick(projectURL)
})
})
Expand Down

0 comments on commit 44eb2a4

Please sign in to comment.