@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.
- package/dist/assets/css/variables.css +1 -1
- package/dist/assets/icons/index.js +37 -0
- package/dist/components/FormModal/index.js +142 -0
- package/dist/components/FormModal/index.module.scss +14 -0
- package/dist/components/NotificationDropdown/index.js +161 -0
- package/dist/components/NotificationDropdown/index.module.scss +80 -0
- package/dist/components/NotificationSettingsContent/index.js +166 -0
- package/dist/components/NotificationSettingsContent/index.module.scss +70 -0
- package/dist/components/ProfileOptions/index.js +128 -0
- package/dist/components/ProfileOptions/index.module.scss +131 -0
- package/dist/index.js +14 -5
- package/dist/layout/Header/index.js +36 -0
- package/dist/layout/Header/index.module.scss +19 -0
- package/dist/store/coreProvider.js +9 -0
- package/dist/store/slices/global/index.js +10 -3
- package/dist/store/slices/notification/index.js +207 -0
- package/dist/store/slices/notification/service.js +121 -0
- package/dist/store/store.js +2 -1
- package/dist/utils/axios.js +7 -6
- package/package.json +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import { Badge, Dropdown, Menu, Tooltip } from "antd";
|
|
4
|
+
import { SunOutlined, MoonOutlined } from "@ant-design/icons";
|
|
5
|
+
import style from "./index.module.scss";
|
|
6
|
+
import { BellOutlined, BellFilled, NotificationOutlined } from "@ant-design/icons";
|
|
7
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
8
|
+
import { Link } from "react-router-dom";
|
|
9
|
+
import { getProfileInfo, scopes } from "../../store/slices/auth";
|
|
10
|
+
import { entryData } from "../../pages/Platform/constant";
|
|
11
|
+
import { CategoryIcon, UserIcon } from "../../assets/icons";
|
|
12
|
+
import { getNotifications } from "../../store/slices/notification";
|
|
13
|
+
import NotificationDropdown from "../NotificationDropdown";
|
|
14
|
+
var ProfileOptions = function ProfileOptions() {
|
|
15
|
+
var dispatch = useDispatch();
|
|
16
|
+
var _useSelector = useSelector(function (state) {
|
|
17
|
+
return state.auth;
|
|
18
|
+
}),
|
|
19
|
+
scopesData = _useSelector.scopesData;
|
|
20
|
+
var profileInfo = useSelector(function (state) {
|
|
21
|
+
return state.auth.profileInfo;
|
|
22
|
+
});
|
|
23
|
+
var _useSelector2 = useSelector(function (state) {
|
|
24
|
+
return state.global;
|
|
25
|
+
}),
|
|
26
|
+
notificationsRender = _useSelector2.notificationsRender;
|
|
27
|
+
var _useState = useState(20),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
size = _useState2[0],
|
|
30
|
+
setSize = _useState2[1];
|
|
31
|
+
var _useState3 = useState(1),
|
|
32
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
|
+
page = _useState4[0],
|
|
34
|
+
setPage = _useState4[1];
|
|
35
|
+
var notifications = useSelector(function (state) {
|
|
36
|
+
return state.notification.notifications;
|
|
37
|
+
});
|
|
38
|
+
console.log(notifications);
|
|
39
|
+
var _useState5 = useState(localStorage.getItem("theme") || "light"),
|
|
40
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
|
+
theme = _useState6[0],
|
|
42
|
+
setTheme = _useState6[1];
|
|
43
|
+
var toggleTheme = function toggleTheme() {
|
|
44
|
+
var newTheme = theme === "light" ? "dark" : "light";
|
|
45
|
+
setTheme(newTheme);
|
|
46
|
+
localStorage.setItem("theme", newTheme);
|
|
47
|
+
document.documentElement.setAttribute("data-theme", newTheme);
|
|
48
|
+
window.dispatchEvent(new Event("themeChange"));
|
|
49
|
+
};
|
|
50
|
+
var NotificationIcon = function NotificationIcon() {
|
|
51
|
+
return /*#__PURE__*/React.createElement(Badge, {
|
|
52
|
+
count: notifications === null || notifications === void 0 ? void 0 : notifications.notReadenCount,
|
|
53
|
+
style: {
|
|
54
|
+
fontSize: "10px",
|
|
55
|
+
height: "16px",
|
|
56
|
+
minWidth: "16px",
|
|
57
|
+
lineHeight: "16px",
|
|
58
|
+
padding: "0 4px"
|
|
59
|
+
}
|
|
60
|
+
}, /*#__PURE__*/React.createElement(BellOutlined, {
|
|
61
|
+
style: {
|
|
62
|
+
fontSize: "20px"
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
66
|
+
useEffect(function () {
|
|
67
|
+
dispatch(scopes());
|
|
68
|
+
dispatch(getProfileInfo());
|
|
69
|
+
}, [dispatch]);
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
dispatch(getNotifications({
|
|
72
|
+
size: size,
|
|
73
|
+
page: page
|
|
74
|
+
}));
|
|
75
|
+
}, [dispatch, size, page, notificationsRender]);
|
|
76
|
+
var rootUrl = window.location.origin;
|
|
77
|
+
var menu1 = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: style.links
|
|
79
|
+
}, entryData === null || entryData === void 0 ? void 0 : entryData.map(function (item) {
|
|
80
|
+
return scopesData === "*" || scopesData !== null && scopesData !== void 0 && scopesData.includes(item.scopes) ? /*#__PURE__*/React.createElement(Link, {
|
|
81
|
+
to: item === null || item === void 0 ? void 0 : item.pathname,
|
|
82
|
+
key: item === null || item === void 0 ? void 0 : item.id
|
|
83
|
+
}, item === null || item === void 0 ? void 0 : item.icon, item === null || item === void 0 ? void 0 : item.value) : /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: style.disableMenu,
|
|
85
|
+
key: item === null || item === void 0 ? void 0 : item.id
|
|
86
|
+
}, item === null || item === void 0 ? void 0 : item.icon, item === null || item === void 0 ? void 0 : item.value);
|
|
87
|
+
}), /*#__PURE__*/React.createElement(Link, {
|
|
88
|
+
to: "".concat(rootUrl, "/accounts")
|
|
89
|
+
}, /*#__PURE__*/React.createElement(UserIcon, null), "\u015E\u0259xsi kabinet")));
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: style.profile
|
|
92
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
93
|
+
title: theme === "dark" ? "Gündüz modu" : "Gecə modu"
|
|
94
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
95
|
+
onClick: toggleTheme,
|
|
96
|
+
"data-no-invert": true,
|
|
97
|
+
className: style.button
|
|
98
|
+
}, theme === "dark" ? /*#__PURE__*/React.createElement(SunOutlined, null) : /*#__PURE__*/React.createElement(MoonOutlined, null))), /*#__PURE__*/React.createElement(Dropdown, {
|
|
99
|
+
overlay: /*#__PURE__*/React.createElement(NotificationDropdown, {
|
|
100
|
+
size: size,
|
|
101
|
+
page: page,
|
|
102
|
+
setSize: setSize,
|
|
103
|
+
setPage: setPage
|
|
104
|
+
}),
|
|
105
|
+
trigger: ["click"],
|
|
106
|
+
placement: "bottomRight",
|
|
107
|
+
overlayClassName: style.notificationDropdown
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
109
|
+
title: "Bildirişlər"
|
|
110
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
111
|
+
"data-no-invert": true,
|
|
112
|
+
className: style.button
|
|
113
|
+
}, /*#__PURE__*/React.createElement(NotificationIcon, null)))), /*#__PURE__*/React.createElement(Dropdown, {
|
|
114
|
+
overlay: menu1,
|
|
115
|
+
trigger: ["click"]
|
|
116
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
117
|
+
className: style.category,
|
|
118
|
+
"data-no-invert-1": true
|
|
119
|
+
}, /*#__PURE__*/React.createElement(CategoryIcon, null))), /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: style.dropdown
|
|
121
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
122
|
+
className: style.pp,
|
|
123
|
+
"data-no-invert": true
|
|
124
|
+
}, profileInfo === null || profileInfo === void 0 ? void 0 : profileInfo.name[0]), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
className: style.name
|
|
126
|
+
}, profileInfo === null || profileInfo === void 0 ? void 0 : profileInfo.name, " ", profileInfo === null || profileInfo === void 0 ? void 0 : profileInfo.surname))));
|
|
127
|
+
};
|
|
128
|
+
export default ProfileOptions;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
.profile {
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: 12px;
|
|
4
|
+
align-items: center;
|
|
5
|
+
.category {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
margin-top: 4px;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
svg {
|
|
11
|
+
width: 30px;
|
|
12
|
+
height: 30px;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
.button {
|
|
16
|
+
background: transparent;
|
|
17
|
+
border: none;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
svg {
|
|
22
|
+
width: 20px;
|
|
23
|
+
margin-top: 3.5px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
.dropdown {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
gap: 8px;
|
|
31
|
+
img {
|
|
32
|
+
width: 39px;
|
|
33
|
+
height: 39px;
|
|
34
|
+
border-radius: 50%;
|
|
35
|
+
border: 1px solid #bebebe;
|
|
36
|
+
}
|
|
37
|
+
.pp {
|
|
38
|
+
width: 39px;
|
|
39
|
+
height: 39px;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
// border: 1px solid #bebebe;
|
|
42
|
+
background: var(--darkBlueColor);
|
|
43
|
+
color: white;
|
|
44
|
+
display: flex;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
align-items: center;
|
|
47
|
+
}
|
|
48
|
+
.name {
|
|
49
|
+
font-family: Inter;
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
font-weight: 400;
|
|
52
|
+
line-height: 16px;
|
|
53
|
+
text-align: left;
|
|
54
|
+
margin-bottom: 4px;
|
|
55
|
+
color: #324054;
|
|
56
|
+
}
|
|
57
|
+
.email {
|
|
58
|
+
font-family: Inter;
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
font-weight: 400;
|
|
61
|
+
line-height: 14px;
|
|
62
|
+
text-align: left;
|
|
63
|
+
color: #71839b;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.links {
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: space-between;
|
|
71
|
+
gap: 30px;
|
|
72
|
+
padding: 20px;
|
|
73
|
+
a {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
justify-content: flex-end;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: 15px;
|
|
79
|
+
width: 133px;
|
|
80
|
+
// height: 133px;
|
|
81
|
+
padding: 20px 5px;
|
|
82
|
+
padding-top: 40px;
|
|
83
|
+
border-radius: 20px;
|
|
84
|
+
background: #f8f8f8;
|
|
85
|
+
font-family: Inter;
|
|
86
|
+
font-size: 14px;
|
|
87
|
+
font-weight: 500;
|
|
88
|
+
line-height: 16.94px;
|
|
89
|
+
text-align: center;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
text-align: center;
|
|
92
|
+
text-decoration: none;
|
|
93
|
+
color: var(--darkBlueColor);
|
|
94
|
+
svg {
|
|
95
|
+
width: 40px;
|
|
96
|
+
height: 40px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
.disableMenu {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
justify-content: flex-end;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: 15px;
|
|
106
|
+
width: 133px;
|
|
107
|
+
// height: 133px;
|
|
108
|
+
padding: 20px 5px;
|
|
109
|
+
padding-top: 40px;
|
|
110
|
+
border-radius: 20px;
|
|
111
|
+
background: #f8f8f8;
|
|
112
|
+
font-family: Inter;
|
|
113
|
+
font-size: 14px;
|
|
114
|
+
font-weight: 500;
|
|
115
|
+
line-height: 16.94px;
|
|
116
|
+
text-align: center;
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
text-align: center;
|
|
119
|
+
text-decoration: none;
|
|
120
|
+
color: var(--darkBlueColor);
|
|
121
|
+
svg {
|
|
122
|
+
width: 40px;
|
|
123
|
+
height: 40px;
|
|
124
|
+
}
|
|
125
|
+
color: #979797;
|
|
126
|
+
svg {
|
|
127
|
+
path {
|
|
128
|
+
fill: #979797;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import "./assets/fonts/fonts.css";
|
|
3
|
-
import "./assets/css/variables.css";
|
|
1
|
+
import React from "react";
|
|
4
2
|
export { default as Button } from "./components/Button";
|
|
5
3
|
export { default as ColSort } from "./components/ColSort";
|
|
6
4
|
export { default as Filter } from "./components/Filter";
|
|
@@ -8,5 +6,16 @@ export { default as Loading } from "./components/Loading";
|
|
|
8
6
|
export { default as Pagination } from "./components/Pagination";
|
|
9
7
|
export { default as useNotification } from "./hooks/useNotification";
|
|
10
8
|
export { default as message } from "./utils/message";
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
import LoginPage from "./pages/Login";
|
|
10
|
+
import PlatformPage from "./pages/Platform";
|
|
11
|
+
import HeaderLayout from "./layout/Header";
|
|
12
|
+
import { CoreProvider } from "./store/coreProvider";
|
|
13
|
+
export var Login = function Login() {
|
|
14
|
+
return /*#__PURE__*/React.createElement(CoreProvider, null, /*#__PURE__*/React.createElement(LoginPage, null));
|
|
15
|
+
};
|
|
16
|
+
export var Platform = function Platform() {
|
|
17
|
+
return /*#__PURE__*/React.createElement(CoreProvider, null, /*#__PURE__*/React.createElement(PlatformPage, null));
|
|
18
|
+
};
|
|
19
|
+
export var Header = function Header() {
|
|
20
|
+
return /*#__PURE__*/React.createElement(CoreProvider, null, /*#__PURE__*/React.createElement(HeaderLayout, null));
|
|
21
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import style from "./index.module.scss";
|
|
4
|
+
import { DsgLogo } from "../../assets/icons";
|
|
5
|
+
import ProfileOptions from "../../components/ProfileOptions";
|
|
6
|
+
import { Link } from "react-router-dom";
|
|
7
|
+
import { PLATFORM_PATH } from "../../utils/path";
|
|
8
|
+
import Logo from "../../assets/balakhaniLogo.png";
|
|
9
|
+
var Header = function Header() {
|
|
10
|
+
var currentUrl = window.location.href;
|
|
11
|
+
var _useState = useState(localStorage.getItem("theme") || "light"),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
theme = _useState2[0],
|
|
14
|
+
setTheme = _useState2[1];
|
|
15
|
+
var updateTheme = function updateTheme() {
|
|
16
|
+
var newTheme = localStorage.getItem("theme") || "light";
|
|
17
|
+
setTheme(newTheme);
|
|
18
|
+
};
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
window.addEventListener("themeChange", updateTheme);
|
|
21
|
+
return function () {
|
|
22
|
+
return window.removeEventListener("themeChange", updateTheme);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
return /*#__PURE__*/React.createElement("header", {
|
|
26
|
+
className: style.header
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
28
|
+
to: PLATFORM_PATH
|
|
29
|
+
}, currentUrl.includes("balakhanioc") ? /*#__PURE__*/React.createElement("img", {
|
|
30
|
+
src: Logo,
|
|
31
|
+
alt: "Balakhani Logo"
|
|
32
|
+
}) : theme === "dark" ? /*#__PURE__*/React.createElement(DsgLogo, {
|
|
33
|
+
dark: true
|
|
34
|
+
}) : /*#__PURE__*/React.createElement(DsgLogo, null)), /*#__PURE__*/React.createElement(ProfileOptions, null));
|
|
35
|
+
};
|
|
36
|
+
export default Header;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.header {
|
|
2
|
+
height: 84px;
|
|
3
|
+
background: #fff;
|
|
4
|
+
align-items: center;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
padding: 0 20px;
|
|
9
|
+
border-bottom: 1px solid #c4c4c4;
|
|
10
|
+
|
|
11
|
+
svg {
|
|
12
|
+
width: 123px;
|
|
13
|
+
height: auto;
|
|
14
|
+
}
|
|
15
|
+
img {
|
|
16
|
+
width: 95px;
|
|
17
|
+
height: auto;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Provider } from "react-redux";
|
|
3
|
+
import store from "./store";
|
|
4
|
+
export var CoreProvider = function CoreProvider(_ref) {
|
|
5
|
+
var children = _ref.children;
|
|
6
|
+
return /*#__PURE__*/React.createElement(Provider, {
|
|
7
|
+
store: store
|
|
8
|
+
}, children);
|
|
9
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createSlice } from "@reduxjs/toolkit";
|
|
2
2
|
var initialState = {
|
|
3
|
-
loading: false
|
|
3
|
+
loading: false,
|
|
4
|
+
notificationsRender: false
|
|
4
5
|
};
|
|
5
6
|
export var global = createSlice({
|
|
6
7
|
name: "global",
|
|
@@ -9,8 +10,14 @@ export var global = createSlice({
|
|
|
9
10
|
setLoading: function setLoading(state, _ref) {
|
|
10
11
|
var payload = _ref.payload;
|
|
11
12
|
state.loading = payload;
|
|
13
|
+
},
|
|
14
|
+
setNotificationsRender: function setNotificationsRender(state, _ref2) {
|
|
15
|
+
var payload = _ref2.payload;
|
|
16
|
+
state.notificationsRender = payload;
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
});
|
|
15
|
-
var
|
|
16
|
-
|
|
20
|
+
var _global$actions = global.actions,
|
|
21
|
+
setLoading = _global$actions.setLoading,
|
|
22
|
+
setNotificationsRender = _global$actions.setNotificationsRender;
|
|
23
|
+
export { setLoading, setNotificationsRender };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
|
|
4
|
+
import Services from "./service";
|
|
5
|
+
import { setNotificationsRender, setLoading, setViewModalVisible } from "../global";
|
|
6
|
+
import { errorMessage } from "../../../utils/message";
|
|
7
|
+
var initialState = {
|
|
8
|
+
notification: []
|
|
9
|
+
};
|
|
10
|
+
export var getNotifications = createAsyncThunk("/getNotifications", /*#__PURE__*/function () {
|
|
11
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data, _ref) {
|
|
12
|
+
var dispatch, response;
|
|
13
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
14
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15
|
+
case 0:
|
|
16
|
+
dispatch = _ref.dispatch;
|
|
17
|
+
_context.prev = 1;
|
|
18
|
+
_context.next = 4;
|
|
19
|
+
return Services.getNotifications(data === null || data === void 0 ? void 0 : data.size, data === null || data === void 0 ? void 0 : data.page);
|
|
20
|
+
case 4:
|
|
21
|
+
response = _context.sent;
|
|
22
|
+
return _context.abrupt("return", response);
|
|
23
|
+
case 8:
|
|
24
|
+
_context.prev = 8;
|
|
25
|
+
_context.t0 = _context["catch"](1);
|
|
26
|
+
errorMessage(_context.t0.response.data.message);
|
|
27
|
+
// dispatch(setLoading(false));
|
|
28
|
+
case 11:
|
|
29
|
+
case "end":
|
|
30
|
+
return _context.stop();
|
|
31
|
+
}
|
|
32
|
+
}, _callee, null, [[1, 8]]);
|
|
33
|
+
}));
|
|
34
|
+
return function (_x, _x2) {
|
|
35
|
+
return _ref2.apply(this, arguments);
|
|
36
|
+
};
|
|
37
|
+
}());
|
|
38
|
+
export var readNotification = createAsyncThunk("/readNotification", /*#__PURE__*/function () {
|
|
39
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data, _ref3) {
|
|
40
|
+
var dispatch, response;
|
|
41
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
42
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
43
|
+
case 0:
|
|
44
|
+
dispatch = _ref3.dispatch;
|
|
45
|
+
_context2.prev = 1;
|
|
46
|
+
_context2.next = 4;
|
|
47
|
+
return Services.readNotification(data);
|
|
48
|
+
case 4:
|
|
49
|
+
response = _context2.sent;
|
|
50
|
+
// dispatch(setLoading(false));
|
|
51
|
+
dispatch(setNotificationsRender(function (prev) {
|
|
52
|
+
return !prev;
|
|
53
|
+
}));
|
|
54
|
+
return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
|
55
|
+
case 9:
|
|
56
|
+
_context2.prev = 9;
|
|
57
|
+
_context2.t0 = _context2["catch"](1);
|
|
58
|
+
errorMessage(_context2.t0.response.data.message);
|
|
59
|
+
// dispatch(setLoading(false));
|
|
60
|
+
case 12:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context2.stop();
|
|
63
|
+
}
|
|
64
|
+
}, _callee2, null, [[1, 9]]);
|
|
65
|
+
}));
|
|
66
|
+
return function (_x3, _x4) {
|
|
67
|
+
return _ref4.apply(this, arguments);
|
|
68
|
+
};
|
|
69
|
+
}());
|
|
70
|
+
export var readNotificationAll = createAsyncThunk("/readNotificationAll", /*#__PURE__*/function () {
|
|
71
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_, _ref5) {
|
|
72
|
+
var dispatch, response;
|
|
73
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
74
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
dispatch = _ref5.dispatch;
|
|
77
|
+
_context3.prev = 1;
|
|
78
|
+
_context3.next = 4;
|
|
79
|
+
return Services.readNotificationAll();
|
|
80
|
+
case 4:
|
|
81
|
+
response = _context3.sent;
|
|
82
|
+
// dispatch(setLoading(false));
|
|
83
|
+
dispatch(setNotificationsRender(function (prev) {
|
|
84
|
+
return !prev;
|
|
85
|
+
}));
|
|
86
|
+
return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
|
87
|
+
case 9:
|
|
88
|
+
_context3.prev = 9;
|
|
89
|
+
_context3.t0 = _context3["catch"](1);
|
|
90
|
+
errorMessage(_context3.t0.response.data.message);
|
|
91
|
+
// dispatch(setLoading(false));
|
|
92
|
+
case 12:
|
|
93
|
+
case "end":
|
|
94
|
+
return _context3.stop();
|
|
95
|
+
}
|
|
96
|
+
}, _callee3, null, [[1, 9]]);
|
|
97
|
+
}));
|
|
98
|
+
return function (_x5, _x6) {
|
|
99
|
+
return _ref6.apply(this, arguments);
|
|
100
|
+
};
|
|
101
|
+
}());
|
|
102
|
+
export var checkNotification = createAsyncThunk("/checkNotification", /*#__PURE__*/function () {
|
|
103
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_, _ref7) {
|
|
104
|
+
var dispatch, response;
|
|
105
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
106
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
dispatch = _ref7.dispatch;
|
|
109
|
+
_context4.prev = 1;
|
|
110
|
+
_context4.next = 4;
|
|
111
|
+
return Services.checkNotification();
|
|
112
|
+
case 4:
|
|
113
|
+
response = _context4.sent;
|
|
114
|
+
return _context4.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
|
115
|
+
case 8:
|
|
116
|
+
_context4.prev = 8;
|
|
117
|
+
_context4.t0 = _context4["catch"](1);
|
|
118
|
+
errorMessage(_context4.t0.response.data.message);
|
|
119
|
+
// dispatch(setLoading(false));
|
|
120
|
+
case 11:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context4.stop();
|
|
123
|
+
}
|
|
124
|
+
}, _callee4, null, [[1, 8]]);
|
|
125
|
+
}));
|
|
126
|
+
return function (_x7, _x8) {
|
|
127
|
+
return _ref8.apply(this, arguments);
|
|
128
|
+
};
|
|
129
|
+
}());
|
|
130
|
+
export var getNotificationSettings = createAsyncThunk("/getNotificationSettings", /*#__PURE__*/function () {
|
|
131
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_, _ref9) {
|
|
132
|
+
var dispatch, response;
|
|
133
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
134
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
135
|
+
case 0:
|
|
136
|
+
dispatch = _ref9.dispatch;
|
|
137
|
+
_context5.prev = 1;
|
|
138
|
+
_context5.next = 4;
|
|
139
|
+
return Services.getNotificationSettings();
|
|
140
|
+
case 4:
|
|
141
|
+
response = _context5.sent;
|
|
142
|
+
return _context5.abrupt("return", response);
|
|
143
|
+
case 8:
|
|
144
|
+
_context5.prev = 8;
|
|
145
|
+
_context5.t0 = _context5["catch"](1);
|
|
146
|
+
errorMessage(_context5.t0.response.data.message);
|
|
147
|
+
// dispatch(setLoading(false));
|
|
148
|
+
case 11:
|
|
149
|
+
case "end":
|
|
150
|
+
return _context5.stop();
|
|
151
|
+
}
|
|
152
|
+
}, _callee5, null, [[1, 8]]);
|
|
153
|
+
}));
|
|
154
|
+
return function (_x9, _x10) {
|
|
155
|
+
return _ref10.apply(this, arguments);
|
|
156
|
+
};
|
|
157
|
+
}());
|
|
158
|
+
export var editNotificationSettings = createAsyncThunk("/editNotificationSettings", /*#__PURE__*/function () {
|
|
159
|
+
var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data, _ref11) {
|
|
160
|
+
var dispatch, response;
|
|
161
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
162
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
163
|
+
case 0:
|
|
164
|
+
dispatch = _ref11.dispatch;
|
|
165
|
+
_context6.prev = 1;
|
|
166
|
+
_context6.next = 4;
|
|
167
|
+
return Services.editNotificationSettings(data);
|
|
168
|
+
case 4:
|
|
169
|
+
response = _context6.sent;
|
|
170
|
+
// dispatch(setLoading(false));
|
|
171
|
+
dispatch(setNotificationsRender(function (prev) {
|
|
172
|
+
return !prev;
|
|
173
|
+
}));
|
|
174
|
+
return _context6.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
|
175
|
+
case 9:
|
|
176
|
+
_context6.prev = 9;
|
|
177
|
+
_context6.t0 = _context6["catch"](1);
|
|
178
|
+
errorMessage(_context6.t0.response.data.message);
|
|
179
|
+
// dispatch(setLoading(false));
|
|
180
|
+
case 12:
|
|
181
|
+
case "end":
|
|
182
|
+
return _context6.stop();
|
|
183
|
+
}
|
|
184
|
+
}, _callee6, null, [[1, 9]]);
|
|
185
|
+
}));
|
|
186
|
+
return function (_x11, _x12) {
|
|
187
|
+
return _ref12.apply(this, arguments);
|
|
188
|
+
};
|
|
189
|
+
}());
|
|
190
|
+
export var notification = createSlice({
|
|
191
|
+
name: "notification",
|
|
192
|
+
initialState: initialState,
|
|
193
|
+
extraReducers: function extraReducers(builder) {
|
|
194
|
+
builder.addCase(getNotifications.fulfilled, function (state, _ref13) {
|
|
195
|
+
var payload = _ref13.payload;
|
|
196
|
+
state.notifications = payload;
|
|
197
|
+
}).addCase(checkNotification.fulfilled, function (state, _ref14) {
|
|
198
|
+
var payload = _ref14.payload;
|
|
199
|
+
state.checkNotification = payload;
|
|
200
|
+
}).addCase(getNotificationSettings.fulfilled, function (state, _ref15) {
|
|
201
|
+
var payload = _ref15.payload;
|
|
202
|
+
state.notificationSettings = payload;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
var setPage = notification.actions.setPage;
|
|
207
|
+
export { setPage };
|