Skip to content

Commit

Permalink
setup completion stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Jun 24, 2024
1 parent e2ddd2d commit 0970193
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/layout/AppHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,19 @@ const AppHeader = () => {
//check if the value of this key is false. If so, set the setupCompleted state to false
//if none is found, set the setupCompleted state to true
useEffect(() => {
if (dashboard && dashboard.length >= 1) {
if (dashboard && Array.isArray(dashboard) && dashboard.length >= 1) {
console.log('Finding if setup is completed.')
const setupCompleted = dashboard.find((alert) => alert.setupCompleted === false)
const setupCompleted = dashboard.find((alert) => alert && alert.setupCompleted === false)
if (setupCompleted) {
console.log("Setup isn't completed yet, we found a match with false.")
dispatch(setSetupCompleted({ setupCompleted: false }))
} else {
console.log('Setup is completed.')
dispatch(setSetupCompleted({ setupCompleted: true }))
}
} else {
console.log('Setup is completed.')
dispatch(setSetupCompleted({ setupCompleted: true }))
}
}, [dashboard, dispatch])

Expand Down

0 comments on commit 0970193

Please sign in to comment.