This repository was archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 540
Expand file tree
/
Copy pathindex.js
More file actions
41 lines (37 loc) · 1.45 KB
/
index.js
File metadata and controls
41 lines (37 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from 'react';
import ReactDOM from 'react-dom';
import endpoint from './endpoint';
import Logo from './react-components/logo.jsx';
import Footer from './react-components/footer.jsx';
import { oauthLogin } from '../common/appId';
import { isEuCountry, showHideEuElements } from '../common/footer-checks';
import GTM from '../common/gtm';
import { load as loadLang, showBanner } from '../common/lang';
import { moveToDeriv } from '../common/utils/utility';
import { getTokenList } from '../common/utils/storageManager';
import { createUrl } from '../common/utils/tools';
import '../common/binary-ui/dropdown';
const renderElements = () => {
ReactDOM.render(<Logo />, document.getElementById('binary-logo'));
ReactDOM.render(<Footer />, document.getElementById('footer'));
isEuCountry().then(isEu => showHideEuElements(isEu));
showBanner();
$('#shop-url').attr('href', createUrl({ subdomain: 'shop', path: 'collections/strategies', isNonBotPage: true }));
};
const loginCheck = () => {
if (endpoint()) return;
moveToDeriv();
if (getTokenList().length) {
window.location.pathname = `${window.location.pathname.replace(/\/+$/, '')}/bot.html`;
} else {
loadLang();
oauthLogin(() => {
$('.show-on-load').show();
$('.barspinner').hide();
renderElements();
/* eslint-disable-next-line no-unused-expressions */
GTM?.init?.();
});
}
};
loginCheck();