generated from UCLALibrary/nuxt3-starter-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor tagLabels logic into a util function
- Loading branch information
Showing
3 changed files
with
38 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Extract tag labels from FTVA filters (ftvaScreeningFormatFilters, | ||
ftvaEventTypeFilters) and return as a single array | ||
* @param {Object} | ||
* @returns {Array} | ||
*/ | ||
|
||
export function getEventFilterLabels(obj) { | ||
if (!obj.ftvaEventTypeFilters && !obj.ftvaScreeningFormatFilters) { | ||
return [] | ||
} | ||
|
||
const parsedTagLabels = [] | ||
|
||
const eventTypeFilters = obj.ftvaEventTypeFilters | ||
const screeningFormatFilters = obj.ftvaScreeningFormatFilters | ||
|
||
if (eventTypeFilters.length) { | ||
eventTypeFilters.forEach(obj => parsedTagLabels.push({ title: obj.title })) | ||
} | ||
|
||
if (screeningFormatFilters.length) { | ||
screeningFormatFilters.forEach(obj => parsedTagLabels.push({ title: obj.title })) | ||
} | ||
|
||
return parsedTagLabels | ||
} |