@twreporter/redux 7.9.1 → 7.10.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [7.10.0-rc.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/redux@7.10.0-rc.0...@twreporter/redux@7.10.0-rc.1) (2024-01-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * remove unused sort ([26b7f52](https://github.com/twreporter/twreporter-npm-packages/commit/26b7f52a9984da298f978a67855c6b55a53890e3))
12
+
13
+
14
+
15
+
16
+
17
+ # [7.10.0-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/redux@7.9.1...@twreporter/redux@7.10.0-rc.0) (2024-01-15)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * pass jwt on `fetchPostsByTagListId` for latest page ([a9e1a19](https://github.com/twreporter/twreporter-npm-packages/commit/a9e1a19f8ae86c27a04ddc94ce641f60138b9b85))
23
+
24
+
25
+ ### Features
26
+
27
+ * pass authentication token when getting latest posts ([d94ae3b](https://github.com/twreporter/twreporter-npm-packages/commit/d94ae3b7f27b4e49b7495be7f28a7747585d0f4b))
28
+
29
+
30
+
31
+
32
+
6
33
  ## [7.9.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/redux@7.9.1-rc.0...@twreporter/redux@7.9.1) (2024-01-03)
7
34
 
8
35
  **Note:** Version bump only for package @twreporter/redux
@@ -198,12 +198,11 @@ function createSingleBookmark(jwt, userID, bookmarkToBeCreated) {
198
198
  * @param {number} userID - id of user
199
199
  * @param {number} offset - the offset of the request
200
200
  * @param {number} limit - max amount of records per fetch
201
- * @param {string} sort - sort by
202
201
  * @return {Function} - function will be executed in Redux Thunk middleware
203
202
  */
204
203
 
205
204
 
206
- function getMultipleBookmarks(jwt, userID, offset, limit, sort) {
205
+ function getMultipleBookmarks(jwt, userID, offset, limit) {
207
206
  /**
208
207
  * @param {Function} dispatch - Redux store dispatch function
209
208
  * @param {Function} getState - Redux store getState function
@@ -219,8 +218,7 @@ function getMultipleBookmarks(jwt, userID, offset, limit, sort) {
219
218
 
220
219
  var url = (0, _url.formURL)(apiOrigin, "/v1/users/".concat(userID, "/bookmarks"), {
221
220
  offset: offset,
222
- limit: limit,
223
- sort: sort
221
+ limit: limit
224
222
  }, false);
225
223
  var axiosConfig = {
226
224
  timeout: apiTimeout,
@@ -150,9 +150,19 @@ function fetchAFullPost(slug) {
150
150
  function _fetchPosts(dispatch, url, successActionType, failureActionType) {
151
151
  var defaultPayload = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
152
152
  var timeout = arguments.length > 5 ? arguments[5] : undefined;
153
- return _axios["default"].get(url, {
153
+ var jwt = arguments.length > 6 ? arguments[6] : undefined;
154
+ var config = {
154
155
  timeout: timeout
155
- }).then(function (response) {
156
+ };
157
+
158
+ if (jwt) {
159
+ config.headers = {
160
+ Authorization: "Bearer ".concat(jwt)
161
+ };
162
+ config.withCredentials = true;
163
+ }
164
+
165
+ return _axios["default"].get(url, config).then(function (response) {
156
166
  var successAction = {
157
167
  type: successActionType,
158
168
  payload: _.merge({
@@ -264,6 +274,7 @@ function fetchPostsByListId(listId, listType) {
264
274
  var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
265
275
  var page = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startPage;
266
276
  var timeout = arguments.length > 4 ? arguments[4] : undefined;
277
+ var jwt = arguments.length > 5 ? arguments[5] : undefined;
267
278
  return function (dispatch, getState) {
268
279
  var fail = function fail(reason) {
269
280
  var action = {
@@ -338,7 +349,7 @@ function fetchPostsByListId(listId, listType) {
338
349
  return _fetchPosts(dispatch, url, _actionTypes["default"].postsByListId.read.success, _actionTypes["default"].postsByListId.read.failure, {
339
350
  listId: listId,
340
351
  page: page
341
- }, timeout);
352
+ }, timeout, jwt);
342
353
  };
343
354
  }
344
355
  /**
@@ -372,9 +383,10 @@ function fetchPostsByCategoryListId(listId) {
372
383
  function fetchPostsByTagListId(listId) {
373
384
  var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
374
385
  var page = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
375
- var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _apiConfig["default"].timeout;
386
+ var jwt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
387
+ var timeout = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _apiConfig["default"].timeout;
376
388
  return function (dispatch, getState) {
377
- return fetchPostsByListId(listId, 'tag_id', limit, page, timeout)(dispatch, getState);
389
+ return fetchPostsByListId(listId, 'tag_id', limit, page, timeout, jwt)(dispatch, getState);
378
390
  };
379
391
  }
380
392
  /**
@@ -409,8 +421,9 @@ function fetchPostsByCategorySetListId(listId) {
409
421
  function fetchLatestPosts() {
410
422
  var limit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
411
423
  var page = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
412
- var timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _apiConfig["default"].timeout;
424
+ var jwt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
425
+ var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _apiConfig["default"].timeout;
413
426
  return function (dispatch, getState) {
414
- return fetchPostsByListId(_latest.LATEST_LIST_ID, 'latest', limit, page, timeout)(dispatch, getState);
427
+ return fetchPostsByListId(_latest.LATEST_LIST_ID, 'latest', limit, page, timeout, jwt)(dispatch, getState);
415
428
  };
416
429
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twreporter/redux",
3
- "version": "7.9.1",
3
+ "version": "7.10.0-rc.1",
4
4
  "description": "redux actions and reducers for twreporter website",
5
5
  "repository": "https://github.com/twreporter/twreporter-npm-packages.git",
6
6
  "author": "twreporter <developer@twreporter.org>",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "homepage": "https://github.com/twreporter/twreporter-redux/#readme",
27
27
  "dependencies": {
28
- "@twreporter/core": "^1.16.0",
28
+ "@twreporter/core": "^1.17.0-rc.0",
29
29
  "axios": "^0.19.0",
30
30
  "es6-error": "^4.0.2",
31
31
  "humps": "^0.6.0",
@@ -45,5 +45,5 @@
45
45
  "files": [
46
46
  "lib"
47
47
  ],
48
- "gitHead": "b1e28b102ba365d97522f0fba70873a78cf2953a"
48
+ "gitHead": "7e4360b31ba449c062234e72a20f30bf31bc2533"
49
49
  }