Skip to content

Commit

Permalink
fix(greenhouse): add support_group only if supportGroups exists and i…
Browse files Browse the repository at this point in the history
…s an array (#608)

* fix(greenhouse): add support_group only if supportGroups exists and is an array

* chore(greenhouse): add changeset

* chore(greenhouse): improve code and converting groups to string
  • Loading branch information
ArtieReus authored Nov 14, 2024
1 parent c9190d0 commit 3810a93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-owls-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudoperators/juno-app-greenhouse": patch
---

add support_group only if supportGroups exists and is an array
13 changes: 10 additions & 3 deletions apps/greenhouse/src/hooks/useApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ const useApi = () => {
const url = conf.status?.uiApplication?.url

// temporary fix to forward initialFilters to the Plugins until middleware is implemented
const appProps = { username: authData?.parsed?.fullName }
appProps.initialFilters = {
support_group: authData?.parsed?.supportGroups?.map((group) => group),
// Extract username and support group information for appProps
const appProps = {
username: authData?.parsed?.fullName,
}

// Conditionally add initialFilters if supportGroups exists and is an array
if (Array.isArray(authData?.parsed?.supportGroups)) {
appProps.initialFilters = {
support_group: authData.parsed.supportGroups.map((group) => String(group)),
}
}

const newConf = createPluginConfig({
Expand Down

0 comments on commit 3810a93

Please sign in to comment.