Skip to content

Commit de72c24

Browse files
authored
Merge pull request #2410 from RedisInsight/fe/feature/RI-4779
#RI-4779 - fix behaviour on open application
2 parents 74cfa55 + 4b1450a commit de72c24

File tree

1 file changed

+15
-10
lines changed
  • redisinsight/desktop/views/cloud_outh_callback

1 file changed

+15
-10
lines changed
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
const protocol = 'redisinsight://';
2-
const callbackUrl = 'cloud/oauth/callback';
1+
const protocol = 'redisinsight://'
2+
const callbackUrl = 'cloud/oauth/callback'
33

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

6-
const openApp = () => {
6+
const openApp = (forceOpen) => {
77
try {
8-
const currentUrl = new URL(window.location.href);
9-
const redirectUrl = protocol + callbackUrl + currentUrl.search;
8+
const currentUrl = new URL(window.location.href)
9+
const redirectUrl = protocol + callbackUrl + currentUrl.search
10+
const isOpened = window.location.hash === '#success'
1011

11-
window.location.href = redirectUrl.toString();
12+
if (forceOpen || !isOpened) {
13+
window.location.href = redirectUrl.toString()
14+
}
15+
16+
window.location.hash = '#success'
1217
} catch (_e) {
1318
//
1419
}
15-
};
20+
}
1621

1722
// handlers
18-
openAppButton.addEventListener('click', openApp);
23+
openAppButton.addEventListener('click', () => openApp(true))
1924

20-
openApp();
25+
openApp()

0 commit comments

Comments
 (0)