From 57b417b3233063c78b34d305115b64fe8c9b9d7a Mon Sep 17 00:00:00 2001 From: Aleksey Konstantinov Date: Wed, 15 Dec 2021 15:13:19 +0300 Subject: [PATCH] ULMS-1671 Added commitEdition method (dispatcher) --- package-lock.json | 2 +- package.json | 2 +- src/dispatcher.js | 11 +++++++++++ src/http-client.js | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9b76a33..2f3f97b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ulms/api-clients", - "version": "4.12.0", + "version": "4.13.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6bec237..0b71edc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ulms/api-clients", - "version": "4.12.0", + "version": "4.13.0", "description": "JavaScript API clients for ULMS platform", "keywords": [], "homepage": "https://github.com/netology-group/ulms-api-clients-js#readme", diff --git a/src/dispatcher.js b/src/dispatcher.js index 4ecb015..51ceb98 100644 --- a/src/dispatcher.js +++ b/src/dispatcher.js @@ -28,6 +28,17 @@ export class Dispatcher extends BasicClient { } } + /** + * Commit edition by scope + * @param {string} audience + * @param {string} scope + * @param {string} editionId + * @returns {Promise} + */ + commitEdition (audience, scope, editionId) { + return this._post(`${this.baseUrl}/audiences/${audience}/classes/${scope}/editions/${editionId}`) + } + /** * Read dispatcher scope * @param {string} kind diff --git a/src/http-client.js b/src/http-client.js index 6714fbe..b8e7808 100644 --- a/src/http-client.js +++ b/src/http-client.js @@ -12,6 +12,8 @@ export class FetchHttpClient { } return response.json() + .catch(() => response.text()) + .catch(() => ({ status: response.status, statusText: response.statusText })) } get (url, config) {