diff --git a/app/assets/javascripts/lib/utils/poll.js b/app/assets/javascripts/lib/utils/poll.js index b6c7c809525a196ebddb5c76f057f0b88739047b..56b6adaed66327f3b4df6f8e8960e1ae55051b20 100644 --- a/app/assets/javascripts/lib/utils/poll.js +++ b/app/assets/javascripts/lib/utils/poll.js @@ -11,21 +11,21 @@ Vue.use(VueResource); * new poll({ * url: 'endopoint', * data: {}, - * successCallback: () => {} - * errorCallback: () => {} + * successCallback: () => {}, + * errorCallback: () => {}, * }).makeRequest(); * * * 1. Checks for response and headers before start polling - * 2. Interval is provided by `X-Poll-Interval` header. - * 3. If `X-Poll-Interval` is -1, we stop polling + * 2. Interval is provided by `Poll-Interval` header. + * 3. If `Poll-Interval` is -1, we stop polling * 4. If HTTP response is 200, we poll. * 5. If HTTP response is different from 200, we stop polling. * */ export default class poll { - constructor(options) { - this.options = options || {}; + constructor(options = {}) { + this.options = options; this.intervalHeader = 'POLL-INTERVAL'; } diff --git a/changelogs/unreleased/29575-polling.yml b/changelogs/unreleased/29575-polling.yml new file mode 100644 index 0000000000000000000000000000000000000000..75016afd455874fbe12fd67c1f3198699d430be7 --- /dev/null +++ b/changelogs/unreleased/29575-polling.yml @@ -0,0 +1,4 @@ +--- +title: Adds polling utility function for vue resource +merge_request: +author: