Skip to content

Commit

Permalink
HBW-90 Add paylod to widget's requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Smirnov committed Nov 14, 2018
1 parent 9e6c1aa commit 6dd9828
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ v1.6.0 [unreleased]
- [#199](https://github.com/latera/homs/pull/199) Move assets generation to Dockerfiles.
- [#207](https://github.com/latera/homs/pull/207) Remove extra locales from moment.js
- [#209](https://github.com/latera/homs/pull/209) Drop react-rails & react_ujs dependencies.
- [#213](https://github.com/latera/homs/pull/213) Add paylod to widget's requests

### Bugfixes
- [#194](https://github.com/latera/homs/pull/194) Set limit on the number of choices in lookup select from sql requests.
Expand Down
8 changes: 8 additions & 0 deletions hbw/app/javascript/packs/hbw/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,19 @@ modulejs.define('HBWConnection', ['jQuery'], (jQuery) => {
this.options.host = `${document.location.protocol}//${document.location.host}`;
}

this.payload = options.payload;

this.serverURL = this.options.host + this.options.path;
this.channels = {};
}

request (...args) {
if (typeof args[0].data === 'undefined') {
Object.assign(args[0], { data : {} });
}

Object.assign(args[0].data, { payload: this.payload || {} });

return jQuery.ajax(...args);
}

Expand Down
3 changes: 2 additions & 1 deletion hbw/app/javascript/packs/hbw/widget.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ modulejs.define(
this.options = options;
const connection = new Connection({
path: this.options.widgetPath,
host: this.options.widgetHost
host: this.options.widgetHost,
payload: this.options.payload
});

this.env = {
Expand Down

0 comments on commit 6dd9828

Please sign in to comment.