sportsbet-mobile
Version:
Sportsbet mobile
76 lines (62 loc) • 1.71 kB
text/typescript
interface Templates {
playerProps: Template;
}
Template.playerProps.onRendered(function() {
Session.set('gameName', 'player-props-dst');
Session.set('forFun', Users.Profile.active() ? false : true);
this.subscribe('Casino.Game', {handle: Session.get('gameName')});
});
Template.playerProps.helpers({
url: gameUrl
});
function gameUrl() {
if (!Template.instance().subscriptionsReady()) {
return;
}
var game = getGame();
var handle = game.handle;
Countries.IpClient.getConnectionCountry(function (err, res) {
if (err) {
return;
}
Session.set('countryClient', res._id);
});
var country = Session.get('countryClient');
if (!country) {
return;
}
Casino.GameClient.checkIfBlocked(handle, country, function (err) {
if (err) {
Session.set('splashTemplate', err.reason);
}
});
Casino.GameClient.checkIfExists(handle, function (err) {
if (err) {
Session.set('splashTemplate', 'gameError');
Session.set('splashMessage', err.details);
}
});
try {
var url = Session.get('forFun') ? game.getDemoUrl('en') : game.getUrl('en');
}
catch (err) {
if (['force_money_error', 'force_login_fun_error', 'force_login_error'].indexOf(err.reason) !== -1) {
Session.set('splashTemplate', err.reason);
}
else {
Session.set('splashTemplate', 'gameError');
}
Session.set('splashMessage', err.localeMessage);
}
if (url) {
url = url.replace('exitURL=%2Fcasino', 'exitURL=https://' + document.domain);
if (url.match(/betsoftgaming/i)) {
url = url + '&homeUrl=https://' + document.domain;
}
if (url.match(/playngonetwork/i)) {
url = url.replace('&lobby=/', ''); //this is fast fix
url = url + '&lobby=http://bitcasino.io';
}
}
return url;
}