{"action":"created","comment":{"url":"https://api.github.com/repos/danliris/bateeq-ui/pulls/comments/137725936","pull_request_review_id":61430584,"id":137725936,"diff_hunk":"@@ -6,149 +6,160 @@ import { Config } from \"aurelia-api\";\n @inject(HttpClient, EventAggregator, Config, \"\")\n export class RestService {\n \n-    constructor(HttpClient, EventAggregator, config, api) {\n-        this.endpoint = config.getEndpoint(api);\n-\n-        this.eventAggregator = EventAggregator;\n+  constructor(HttpClient, EventAggregator, config, api) {\n+    this.endpoint = config.getEndpoint(api); \n+    // this._config =config; \n+    \n+    // console.log(this.endpoint.defaults);\n+    // console.log(this.endpoint.client.defaults);\n+    // const timezoneOffsetHeader = \"x-timezone-offset\";\n+    // var timezone = this.endpoint.defaults.headers[\"x-timezone-offset\"];\n+    // this.endpoint.client.defaults =  this.endpoint.defaults;\n+    this.eventAggregator = EventAggregator;\n+  }\n+\n+  publish(promise) {\n+    this.eventAggregator.publish('httpRequest', promise);\n+  }\n+\n+  parseResult(result) {\n+    if (result.error) {\n+      return Promise.reject(result.error);\n     }\n-\n-    publish(promise) {\n-        this.eventAggregator.publish('httpRequest', promise);\n+    else {\n+      return Promise.resolve(result.data)\n     }\n+  }\n \n-    parseResult(result) {\n-        if (result.error) {\n-            return Promise.reject(result.error);\n-        }\n-        else {\n-            return Promise.resolve(result.data)\n-        }\n-    }\n+  list(endpoint, info, header) {\n+    var _info = Object.assign({}, info);\n \n-    list(endpoint, info, header) {\n-        var _info = Object.assign({}, info);\n-        delete _info.order;\n-        var promise = this.endpoint.find(endpoint, _info);\n-        this.publish(promise);\n-        return promise\n-            .then((result) => {\n-                this.publish(promise);\n-                return Promise.resolve(result);\n-            });\n-    }\n+    if (_info.order && typeof _info.order === \"object\")\n+      _info.order = JSON.stringify(_info.order);\n+    else\n+      delete _info.order;\n \n-    get(endpoint, header) {\n-        var promise = this.endpoint.find(endpoint)\n+    var promise = this.endpoint.find(endpoint, _info);\n+    this.publish(promise);\n+    return promise\n+      .then((result) => {\n         this.publish(promise);\n-        return promise\n-            .then((result) => {\n-                this.publish(promise);\n-                return this.parseResult(result);\n-            });\n-    }\n-\n-    post(endpoint, data, header) {\n-        var promise = this.endpoint.post(endpoint, data);\n+        return Promise.resolve(result);\n+      });\n+  }\n+\n+  get(endpoint, header, info) {\n+    var promise = this.endpoint.find(endpoint, info)\n+    this.publish(promise);\n+    return promise\n+      .then((result) => {\n         this.publish(promise);\n-        return promise\n-            .catch(e => {\n-                return e.json().then(result => {\n-                    if (result.error)\n-                        return Promise.resolve(result);\n-                });\n-            })\n-            .then(result => {\n-                this.publish(promise);\n-                if (result)\n-                    return this.parseResult(result);\n-                else\n-                    return Promise.resolve({});\n-            })\n-    }\n-\n-    put(endpoint, data, header) {\n-        var promise = this.endpoint.update(endpoint, null, data);\n+        return this.parseResult(result);\n+      });\n+  }\n+\n+  post(endpoint, data, header) {\n+    var promise = this.endpoint.post(endpoint, data);\n+    this.publish(promise);\n+    return promise\n+      .catch(e => {\n+        return e.json().then(result => {\n+          if (result.error)\n+            return Promise.resolve(result);\n+        });\n+      })\n+      .then(result => {\n         this.publish(promise);\n-        return promise\n-            .catch(e => {\n-                return e.json().then(result => {\n-                    if (result.error)\n-                        return Promise.resolve(result);\n-                });\n-            })\n-            .then(result => {\n-                this.publish(promise);\n-                if (result)\n-                    return this.parseResult(result);\n-                else\n-                    return Promise.resolve({});\n-            })\n-    }\n-\n-    delete(endpoint, data, header) {\n-        var promise = this.endpoint.destroy(endpoint);\n+        if (result)\n+          return this.parseResult(result);\n+        else\n+          return Promise.resolve({});\n+      })\n+  }\n+\n+  put(endpoint, data, header) {\n+    var promise = this.endpoint.update(endpoint, null, data);\n+    this.publish(promise);\n+    return promise\n+      .catch(e => {\n+        return e.json().then(result => {\n+          if (result.error)\n+            return Promise.resolve(result);\n+        });\n+      })\n+      .then(result => {\n         this.publish(promise);\n-        return promise\n-            .catch(e => {\n-                return e.json().then(result => {\n-                    if (result.error)\n-                        return Promise.resolve(result);\n-                });\n-            })\n-            .then(result => {\n-                this.publish(promise);\n-                if (result)\n-                    return this.parseResult(result);\n-                else\n-                    return Promise.resolve({});\n-            })\n-    }\n-\n-\n-\n-    getXls(endpoint, header) {\n-        var request = {\n-            method: 'GET',\n-            headers: new Headers(Object.assign({}, this.header, header, { \"Accept\": \"application/xls\" }))\n-        };\n-        var getRequest = this.endpoint.client.fetch(endpoint, request)\n-        this.publish(getRequest);\n-\n-        return this._downloadFile(getRequest);\n-    }\n-\n-    getPdf(endpoint, header) {\n-        var request = {\n-            method: 'GET',\n-            headers: new Headers(Object.assign({}, this.header, header, { \"Accept\": \"application/pdf\" }))\n-        };\n-        var getRequest = this.endpoint.client.fetch(endpoint, request)\n-        this.publish(getRequest);\n-        return this._downloadFile(getRequest);\n-\n-    }\n-\n-    _downloadFile(request) {\n-        return request\n-            .then(response => {\n-                if (response.status == 200)\n-                    return Promise.resolve(response);\n-                else\n-                    return Promise.reject(new Error('Error downloading file'));\n+        if (result)\n+          return this.parseResult(result);\n+        else\n+          return Promise.resolve({});\n+      })\n+  }\n+\n+  delete(endpoint, data, header) {\n+    var promise = this.endpoint.destroy(endpoint);\n+    this.publish(promise);\n+    return promise\n+      .catch(e => {\n+        return e.json().then(result => {\n+          if (result.error)\n+            return Promise.resolve(result);\n+        });\n+      })\n+      .then(result => {\n+        this.publish(promise);\n+        if (result)\n+          return this.parseResult(result);\n+        else\n+          return Promise.resolve({});\n+      })","path":"src/utils/rest-service.js","position":145,"original_position":230,"commit_id":"706e105bf1858732d4f1cee89bafd05a1afe21f2","original_commit_id":"706e105bf1858732d4f1cee89bafd05a1afe21f2","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Missing semicolon.","created_at":"2017-09-08T07:32:31Z","updated_at":"2017-09-08T07:32:32Z","html_url":"https://github.com/danliris/bateeq-ui/pull/263#discussion_r137725936","pull_request_url":"https://api.github.com/repos/danliris/bateeq-ui/pulls/263","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/danliris/bateeq-ui/pulls/comments/137725936"},"html":{"href":"https://github.com/danliris/bateeq-ui/pull/263#discussion_r137725936"},"pull_request":{"href":"https://api.github.com/repos/danliris/bateeq-ui/pulls/263"}}},"pull_request":{"url":"https://api.github.com/repos/danliris/bateeq-ui/pulls/263","id":139972244,"html_url":"https://github.com/danliris/bateeq-ui/pull/263","diff_url":"https://github.com/danliris/bateeq-ui/pull/263.diff","patch_url":"https://github.com/danliris/bateeq-ui/pull/263.patch","issue_url":"https://api.github.com/repos/danliris/bateeq-ui/issues/263","number":263,"state":"open","locked":false,"title":"Revert \"Revert \"Dev Omset Harian to UAT\"\"","user":{"login":"edo-moonlay","id":31334028,"avatar_url":"https://avatars2.githubusercontent.com/u/31334028?v=4","gravatar_id":"","url":"https://api.github.com/users/edo-moonlay","html_url":"https://github.com/edo-moonlay","followers_url":"https://api.github.com/users/edo-moonlay/followers","following_url":"https://api.github.com/users/edo-moonlay/following{/other_user}","gists_url":"https://api.github.com/users/edo-moonlay/gists{/gist_id}","starred_url":"https://api.github.com/users/edo-moonlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edo-moonlay/subscriptions","organizations_url":"https://api.github.com/users/edo-moonlay/orgs","repos_url":"https://api.github.com/users/edo-moonlay/repos","events_url":"https://api.github.com/users/edo-moonlay/events{/privacy}","received_events_url":"https://api.github.com/users/edo-moonlay/received_events","type":"User","site_admin":false},"body":"Reverts danliris/bateeq-ui#262","created_at":"2017-09-08T07:32:21Z","updated_at":"2017-09-08T07:32:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e355853b7bc48263a1f994a2a0d2c841b242661","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/danliris/bateeq-ui/pulls/263/commits","review_comments_url":"https://api.github.com/repos/danliris/bateeq-ui/pulls/263/comments","review_comment_url":"https://api.github.com/repos/danliris/bateeq-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/danliris/bateeq-ui/issues/263/comments","statuses_url":"https://api.github.com/repos/danliris/bateeq-ui/statuses/706e105bf1858732d4f1cee89bafd05a1afe21f2","head":{"label":"danliris:revert-262-revert-261-dev","ref":"revert-262-revert-261-dev","sha":"706e105bf1858732d4f1cee89bafd05a1afe21f2","user":{"login":"danliris","id":20855729,"avatar_url":"https://avatars0.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"repo":{"id":60683096,"name":"bateeq-ui","full_name":"danliris/bateeq-ui","owner":{"login":"danliris","id":20855729,"avatar_url":"https://avatars0.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danliris/bateeq-ui","description":null,"fork":false,"url":"https://api.github.com/repos/danliris/bateeq-ui","forks_url":"https://api.github.com/repos/danliris/bateeq-ui/forks","keys_url":"https://api.github.com/repos/danliris/bateeq-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danliris/bateeq-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danliris/bateeq-ui/teams","hooks_url":"https://api.github.com/repos/danliris/bateeq-ui/hooks","issue_events_url":"https://api.github.com/repos/danliris/bateeq-ui/issues/events{/number}","events_url":"https://api.github.com/repos/danliris/bateeq-ui/events","assignees_url":"https://api.github.com/repos/danliris/bateeq-ui/assignees{/user}","branches_url":"https://api.github.com/repos/danliris/bateeq-ui/branches{/branch}","tags_url":"https://api.github.com/repos/danliris/bateeq-ui/tags","blobs_url":"https://api.github.com/repos/danliris/bateeq-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danliris/bateeq-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danliris/bateeq-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/danliris/bateeq-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danliris/bateeq-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/danliris/bateeq-ui/languages","stargazers_url":"https://api.github.com/repos/danliris/bateeq-ui/stargazers","contributors_url":"https://api.github.com/repos/danliris/bateeq-ui/contributors","subscribers_url":"https://api.github.com/repos/danliris/bateeq-ui/subscribers","subscription_url":"https://api.github.com/repos/danliris/bateeq-ui/subscription","commits_url":"https://api.github.com/repos/danliris/bateeq-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/danliris/bateeq-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/danliris/bateeq-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/danliris/bateeq-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/danliris/bateeq-ui/contents/{+path}","compare_url":"https://api.github.com/repos/danliris/bateeq-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danliris/bateeq-ui/merges","archive_url":"https://api.github.com/repos/danliris/bateeq-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danliris/bateeq-ui/downloads","issues_url":"https://api.github.com/repos/danliris/bateeq-ui/issues{/number}","pulls_url":"https://api.github.com/repos/danliris/bateeq-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/danliris/bateeq-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/danliris/bateeq-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danliris/bateeq-ui/labels{/name}","releases_url":"https://api.github.com/repos/danliris/bateeq-ui/releases{/id}","deployments_url":"https://api.github.com/repos/danliris/bateeq-ui/deployments","created_at":"2016-06-08T08:48:48Z","updated_at":"2017-01-16T04:06:33Z","pushed_at":"2017-09-08T07:32:22Z","git_url":"git://github.com/danliris/bateeq-ui.git","ssh_url":"git@github.com:danliris/bateeq-ui.git","clone_url":"https://github.com/danliris/bateeq-ui.git","svn_url":"https://github.com/danliris/bateeq-ui","homepage":null,"size":817,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":1,"forks":17,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"danliris:uat","ref":"uat","sha":"ea0faeef3f019d8729ae254c4fcf1efde30048f5","user":{"login":"danliris","id":20855729,"avatar_url":"https://avatars0.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"repo":{"id":60683096,"name":"bateeq-ui","full_name":"danliris/bateeq-ui","owner":{"login":"danliris","id":20855729,"avatar_url":"https://avatars0.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danliris/bateeq-ui","description":null,"fork":false,"url":"https://api.github.com/repos/danliris/bateeq-ui","forks_url":"https://api.github.com/repos/danliris/bateeq-ui/forks","keys_url":"https://api.github.com/repos/danliris/bateeq-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danliris/bateeq-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danliris/bateeq-ui/teams","hooks_url":"https://api.github.com/repos/danliris/bateeq-ui/hooks","issue_events_url":"https://api.github.com/repos/danliris/bateeq-ui/issues/events{/number}","events_url":"https://api.github.com/repos/danliris/bateeq-ui/events","assignees_url":"https://api.github.com/repos/danliris/bateeq-ui/assignees{/user}","branches_url":"https://api.github.com/repos/danliris/bateeq-ui/branches{/branch}","tags_url":"https://api.github.com/repos/danliris/bateeq-ui/tags","blobs_url":"https://api.github.com/repos/danliris/bateeq-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danliris/bateeq-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danliris/bateeq-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/danliris/bateeq-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danliris/bateeq-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/danliris/bateeq-ui/languages","stargazers_url":"https://api.github.com/repos/danliris/bateeq-ui/stargazers","contributors_url":"https://api.github.com/repos/danliris/bateeq-ui/contributors","subscribers_url":"https://api.github.com/repos/danliris/bateeq-ui/subscribers","subscription_url":"https://api.github.com/repos/danliris/bateeq-ui/subscription","commits_url":"https://api.github.com/repos/danliris/bateeq-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/danliris/bateeq-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/danliris/bateeq-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/danliris/bateeq-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/danliris/bateeq-ui/contents/{+path}","compare_url":"https://api.github.com/repos/danliris/bateeq-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danliris/bateeq-ui/merges","archive_url":"https://api.github.com/repos/danliris/bateeq-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danliris/bateeq-ui/downloads","issues_url":"https://api.github.com/repos/danliris/bateeq-ui/issues{/number}","pulls_url":"https://api.github.com/repos/danliris/bateeq-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/danliris/bateeq-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/danliris/bateeq-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danliris/bateeq-ui/labels{/name}","releases_url":"https://api.github.com/repos/danliris/bateeq-ui/releases{/id}","deployments_url":"https://api.github.com/repos/danliris/bateeq-ui/deployments","created_at":"2016-06-08T08:48:48Z","updated_at":"2017-01-16T04:06:33Z","pushed_at":"2017-09-08T07:32:22Z","git_url":"git://github.com/danliris/bateeq-ui.git","ssh_url":"git@github.com:danliris/bateeq-ui.git","clone_url":"https://github.com/danliris/bateeq-ui.git","svn_url":"https://github.com/danliris/bateeq-ui","homepage":null,"size":817,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":1,"forks":17,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/danliris/bateeq-ui/pulls/263"},"html":{"href":"https://github.com/danliris/bateeq-ui/pull/263"},"issue":{"href":"https://api.github.com/repos/danliris/bateeq-ui/issues/263"},"comments":{"href":"https://api.github.com/repos/danliris/bateeq-ui/issues/263/comments"},"review_comments":{"href":"https://api.github.com/repos/danliris/bateeq-ui/pulls/263/comments"},"review_comment":{"href":"https://api.github.com/repos/danliris/bateeq-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/danliris/bateeq-ui/pulls/263/commits"},"statuses":{"href":"https://api.github.com/repos/danliris/bateeq-ui/statuses/706e105bf1858732d4f1cee89bafd05a1afe21f2"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"houndci-bot"}}