@banch0u/core-project-test-repository 1.3.1 → 1.4.0

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.
@@ -0,0 +1,121 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ import api from "../../../utils/axios";
7
+ var Services = /*#__PURE__*/_createClass(function Services() {
8
+ _classCallCheck(this, Services);
9
+ });
10
+ _defineProperty(Services, "getNotifications", /*#__PURE__*/function () {
11
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(size, page) {
12
+ var response;
13
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
14
+ while (1) switch (_context.prev = _context.next) {
15
+ case 0:
16
+ _context.next = 2;
17
+ return api.get("/NotificationDetails/".concat(size, "/page/").concat(page));
18
+ case 2:
19
+ response = _context.sent;
20
+ return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
21
+ case 4:
22
+ case "end":
23
+ return _context.stop();
24
+ }
25
+ }, _callee);
26
+ }));
27
+ return function (_x, _x2) {
28
+ return _ref.apply(this, arguments);
29
+ };
30
+ }());
31
+ _defineProperty(Services, "readNotification", /*#__PURE__*/function () {
32
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
33
+ var response;
34
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
35
+ while (1) switch (_context2.prev = _context2.next) {
36
+ case 0:
37
+ _context2.next = 2;
38
+ return api.post("/NotificationDetails", data);
39
+ case 2:
40
+ response = _context2.sent;
41
+ return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
42
+ case 4:
43
+ case "end":
44
+ return _context2.stop();
45
+ }
46
+ }, _callee2);
47
+ }));
48
+ return function (_x3) {
49
+ return _ref2.apply(this, arguments);
50
+ };
51
+ }());
52
+ _defineProperty(Services, "readNotificationAll", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
53
+ var response;
54
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
55
+ while (1) switch (_context3.prev = _context3.next) {
56
+ case 0:
57
+ _context3.next = 2;
58
+ return api.post("/NotificationDetails/ReadAll");
59
+ case 2:
60
+ response = _context3.sent;
61
+ return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
62
+ case 4:
63
+ case "end":
64
+ return _context3.stop();
65
+ }
66
+ }, _callee3);
67
+ })));
68
+ _defineProperty(Services, "checkNotification", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
69
+ var response;
70
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
71
+ while (1) switch (_context4.prev = _context4.next) {
72
+ case 0:
73
+ _context4.next = 2;
74
+ return api.get("/notificationusersettings/check");
75
+ case 2:
76
+ response = _context4.sent;
77
+ return _context4.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
78
+ case 4:
79
+ case "end":
80
+ return _context4.stop();
81
+ }
82
+ }, _callee4);
83
+ })));
84
+ _defineProperty(Services, "getNotificationSettings", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
85
+ var response;
86
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
87
+ while (1) switch (_context5.prev = _context5.next) {
88
+ case 0:
89
+ _context5.next = 2;
90
+ return api.get("/notificationusersettings");
91
+ case 2:
92
+ response = _context5.sent;
93
+ return _context5.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
94
+ case 4:
95
+ case "end":
96
+ return _context5.stop();
97
+ }
98
+ }, _callee5);
99
+ })));
100
+ _defineProperty(Services, "editNotificationSettings", /*#__PURE__*/function () {
101
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data) {
102
+ var response;
103
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
104
+ while (1) switch (_context6.prev = _context6.next) {
105
+ case 0:
106
+ _context6.next = 2;
107
+ return api.post("/notificationusersettings", data);
108
+ case 2:
109
+ response = _context6.sent;
110
+ return _context6.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
111
+ case 4:
112
+ case "end":
113
+ return _context6.stop();
114
+ }
115
+ }, _callee6);
116
+ }));
117
+ return function (_x4) {
118
+ return _ref6.apply(this, arguments);
119
+ };
120
+ }());
121
+ export default Services;
@@ -2,7 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { configureStore } from "@reduxjs/toolkit";
3
3
  import { global } from "./slices/global";
4
4
  import { auth } from "./slices/auth";
5
+ import { notification } from "./slices/notification";
5
6
  export var store = configureStore({
6
- reducer: _defineProperty(_defineProperty({}, global.name, global.reducer), auth.name, auth.reducer)
7
+ reducer: _defineProperty(_defineProperty(_defineProperty({}, notification.name, notification.reducer), global.name, global.reducer), auth.name, auth.reducer)
7
8
  });
8
9
  export default store;
@@ -134,13 +134,13 @@ api.interceptors.response.use(function (response) {
134
134
  // Pass through successful responses
135
135
  function () {
136
136
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(error) {
137
- var originalRequest, newAccessToken;
137
+ var originalRequest, newAccessToken, basePath, redirectPath;
138
138
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
139
139
  while (1) switch (_context2.prev = _context2.next) {
140
140
  case 0:
141
141
  originalRequest = error.config;
142
142
  if (!(error.response.status === 401 && !originalRequest._retry)) {
143
- _context2.next = 16;
143
+ _context2.next = 18;
144
144
  break;
145
145
  }
146
146
  originalRequest._retry = true; // Prevent infinite retry loops
@@ -154,13 +154,14 @@ function () {
154
154
  case 11:
155
155
  _context2.prev = 11;
156
156
  _context2.t0 = _context2["catch"](3);
157
- // Handle failed token refresh logic (e.g., logout user)
157
+ basePath = window.location.pathname.split("/")[1];
158
+ redirectPath = "/".concat(basePath, "/login");
158
159
  console.error("Token refresh failed:", _context2.t0);
159
- window.location.href = "/docflow/login"; //Comment this to prevent logout
160
+ window.location.href = redirectPath;
160
161
  return _context2.abrupt("return", Promise.reject(_context2.t0));
161
- case 16:
162
+ case 18:
162
163
  return _context2.abrupt("return", Promise.reject(error));
163
- case 17:
164
+ case 19:
164
165
  case "end":
165
166
  return _context2.stop();
166
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@banch0u/core-project-test-repository",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Shared core features for all projects",
5
5
  "main": "dist/index.js",
6
6
  "files": [