@ndlib/component-library 1.0.20 → 1.0.21
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.
|
@@ -64,7 +64,7 @@ const useAlertsQuery = ({ domain = ALERT_DOMAIN.LIBRARY, endpoint = DEFAULT_ENDP
|
|
|
64
64
|
const [alerts, setAlerts] = useState([]);
|
|
65
65
|
useEffect(() => {
|
|
66
66
|
const fetchData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
-
var _a, _b, _c;
|
|
67
|
+
var _a, _b, _c, _d, _e;
|
|
68
68
|
try {
|
|
69
69
|
const myHeaders = new Headers();
|
|
70
70
|
myHeaders.append('Content-Type', 'application/json');
|
|
@@ -78,8 +78,10 @@ const useAlertsQuery = ({ domain = ALERT_DOMAIN.LIBRARY, endpoint = DEFAULT_ENDP
|
|
|
78
78
|
redirect: 'follow',
|
|
79
79
|
});
|
|
80
80
|
const json = yield response.json();
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
if ((_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.alerts) === null || _b === void 0 ? void 0 : _b.data) {
|
|
82
|
+
const results = (_e = (_d = (_c = json === null || json === void 0 ? void 0 : json.data) === null || _c === void 0 ? void 0 : _c.alerts) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.map((a) => a === null || a === void 0 ? void 0 : a.attributes);
|
|
83
|
+
setAlerts(results);
|
|
84
|
+
}
|
|
83
85
|
}
|
|
84
86
|
catch (error) {
|
|
85
87
|
console.error('error', error);
|