forked from binary-com/binary-static
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredirect.js
More file actions
28 lines (24 loc) · 1.15 KB
/
Copy pathredirect.js
File metadata and controls
28 lines (24 loc) · 1.15 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
const defaultRedirectUrl = require('./client').defaultRedirectUrl;
const Url = require('../../_common/url');
const Redirect = (() => {
const onLoad = () => {
const actions_map = {
signup : { path: 'new_account/virtualws' },
reset_password : { path: 'user/reset_passwordws' },
trading_platform_mt5_password_reset : { path: 'user/trading_reset_passwordws' },
payment_withdraw : { path: 'cashier/forwardws', query: 'action=withdraw' },
payment_agent_withdraw : { path: 'paymentagent/withdrawws' },
trading_platform_investor_password_reset: { path: 'user/metatrader' },
};
const params = Url.paramsHash();
const config = actions_map[params.action];
// need to redirect not using pjax
window.location.href = config && params.code ?
`${Url.urlFor(config.path, config.query, params.lang || '')}#token=${params.code}` :
defaultRedirectUrl();
};
return {
onLoad,
};
})();
module.exports = Redirect;