mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat: Rewrite Front End cloud and posthog hooks using TypeScript (no-changelog) (#5491)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
export function addAutoLoginToAdminPanelButton() {
|
||||
const adminPanelHost = new URL(window.location.href).host.split('.').slice(1).join('.');
|
||||
|
||||
document.body?.addEventListener('click', async (e) => {
|
||||
if (!e.target || !(e.target instanceof Element)) return;
|
||||
if (e.target.getAttribute('id') !== 'admin' && !e.target.closest('#admin')) return;
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
const restPath = window.REST_ENDPOINT ?? 'rest';
|
||||
const response = await fetch(`/${restPath}/cloud/proxy/login/code`);
|
||||
const { code } = await response.json();
|
||||
window.location.href = `https://${adminPanelHost}/login?code=${code}`;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user