Skip to content

Commit b978ba5

Browse files
author
ChadKluck
committed
updated view
1 parent 1c99329 commit b978ba5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

application-infrastructure/src/views/example.view.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
*/
44

55
const { tools: {Timer} } = require("@63klabs/cache-data");
6+
const { DebugAndLog } = require("@63klabs/cache-data/src/lib/tools");
67

78
const logIdentifier = "Example View";
89

910
/**
10-
* Generic filter
11+
* Generic filter to exclude null values
1112
* @param {object} data
1213
* @returns {boolean} exclude
1314
*/
@@ -37,14 +38,15 @@ const transform = (data) => {
3738

3839
/**
3940
* Generic view
40-
* @param {object} data
41+
* @param {object} resultsFromSvc
4142
* @returns {{count: number, items: Array<{id: number, display: string}>}} data
4243
*/
43-
exports.view = (data) => {
44+
exports.view = (resultsFromSvc) => {
4445
const viewTimer = new Timer(`Timer: ${logIdentifier}`, true);
46+
DebugAndLog.debug(`View: ${logIdentifier}`, data);
4547

4648
// if data then data else empty array
47-
const dataArray = data || [];
49+
const dataArray = Array.isArray(resultsFromSvc?.gamechoices) ? resultsFromSvc?.gamechoices : [];
4850

4951
// The filter and transform functions can be customized or replaced as needed
5052
// They can also be combined so that the filter and transform are done in one pass

0 commit comments

Comments
 (0)