Skip to content

Commit

Permalink
Update initialize.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lesichkovm authored Jul 5, 2020
1 parent 9c1e04e commit cec414f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ function Initialize() {

this.ws = function (command, data) {
var data = (typeof data === "undefined") ? {} : data;
var cmd = trim(command,"/");
var token = this.getToken();
if (token !== null) {
if (typeof data === 'string' || data instanceof String) {
Expand All @@ -424,11 +425,11 @@ function Initialize() {
data["Token"] = token;
}
}
var url = "";
var url = Config.getApiUrl();
if (Config.getApiUrl().endsWith('/') || command.endsWith('.json')) {
url = Config.getApiUrl() + '?command=' + command + '&ts=' + Math.round(+new Date() / 1000);
url += '?command=' + command + '&ts=' + Math.round(+new Date() / 1000);
} else {
url = Config.getApiUrl() + '/' + command + '/?ts=' + Math.round(+new Date() / 1000);
url += '/' + command + '/?ts=' + Math.round(+new Date() / 1000);
}
var dataType = command.endsWith('.json') ? 'json' : 'jsonp';
var p = $.ajax({
Expand Down

0 comments on commit cec414f

Please sign in to comment.