Skip to content

Commit

Permalink
intercept logout click and emit logout event when editor is embedded
Browse files Browse the repository at this point in the history
cstns committed Sep 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ad84321 commit 2ad04ec
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
@@ -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')
@@ -102,7 +114,7 @@
}
})
}

interceptLogOutClick()
interceptLogoClick(projectURL)
})
})

0 comments on commit 2ad04ec

Please sign in to comment.