@ministryofjustice/hmpps-digital-prison-reporting-frontend 3.26.5 → 3.26.7
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.
|
@@ -27,7 +27,7 @@ class UserDataStore {
|
|
|
27
27
|
async getUserConfig(userId) {
|
|
28
28
|
await this.ensureConnected();
|
|
29
29
|
const userConfig = await this.redisClient.get(`${this.prefix}${userId}`);
|
|
30
|
-
return userConfig ? JSON.parse(userConfig) :
|
|
30
|
+
return userConfig ? JSON.parse(userConfig) : baseplateStore;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.default = UserDataStore;
|
|
@@ -32,7 +32,7 @@ export default class UserDataStore {
|
|
|
32
32
|
public async getUserConfig(userId: string): Promise<UserStoreConfig> {
|
|
33
33
|
await this.ensureConnected()
|
|
34
34
|
const userConfig = await this.redisClient.get(`${this.prefix}${userId}`)
|
|
35
|
-
return userConfig ? JSON.parse(userConfig) :
|
|
35
|
+
return userConfig ? JSON.parse(userConfig) : baseplateStore
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -106,8 +106,10 @@ const formatTableData = (card, type) => {
|
|
|
106
106
|
};
|
|
107
107
|
exports.formatTableData = formatTableData;
|
|
108
108
|
const formatCards = async (reports, filterFunction, formatFunction) => {
|
|
109
|
-
return reports
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
return reports
|
|
110
|
+
? reports.filter(filterFunction).map((report) => {
|
|
111
|
+
return formatFunction(report);
|
|
112
|
+
})
|
|
113
|
+
: Promise.resolve([]);
|
|
112
114
|
};
|
|
113
115
|
exports.formatCards = formatCards;
|
|
@@ -115,7 +115,9 @@ export const formatCards = async (
|
|
|
115
115
|
filterFunction: (report: AsyncReportData | RecentlyViewedReportData) => boolean,
|
|
116
116
|
formatFunction: (reportData: RecentlyViewedReportData | AsyncReportData) => CardData,
|
|
117
117
|
): Promise<CardData[]> => {
|
|
118
|
-
return reports
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
return reports
|
|
119
|
+
? reports.filter(filterFunction).map((report: AsyncReportData | RecentlyViewedReportData) => {
|
|
120
|
+
return formatFunction(report)
|
|
121
|
+
})
|
|
122
|
+
: Promise.resolve([])
|
|
121
123
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ministryofjustice/hmpps-digital-prison-reporting-frontend",
|
|
3
3
|
"description": "The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.",
|
|
4
|
-
"version": "3.26.
|
|
4
|
+
"version": "3.26.7",
|
|
5
5
|
"main": "dpr/assets/js/all.mjs",
|
|
6
6
|
"sass": "dpr/all.scss",
|
|
7
7
|
"engines": {
|
package/package.zip
CHANGED
|
Binary file
|