Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions redisinsight/desktop/views/cloud_outh_callback/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
const protocol = 'redisinsight://';
const callbackUrl = 'cloud/oauth/callback';
const protocol = 'redisinsight://'
const callbackUrl = 'cloud/oauth/callback'

const openAppButton = document.querySelector('#open-app');
const openAppButton = document.querySelector('#open-app')

const openApp = () => {
const openApp = (forceOpen) => {
try {
const currentUrl = new URL(window.location.href);
const redirectUrl = protocol + callbackUrl + currentUrl.search;
const currentUrl = new URL(window.location.href)
const redirectUrl = protocol + callbackUrl + currentUrl.search
const isOpened = window.location.hash === '#success'

window.location.href = redirectUrl.toString();
if (forceOpen || !isOpened) {
window.location.href = redirectUrl.toString()
}

window.location.hash = '#success'
} catch (_e) {
//
}
};
}

// handlers
openAppButton.addEventListener('click', openApp);
openAppButton.addEventListener('click', () => openApp(true))

openApp();
openApp()