Skip to content

Commit

Permalink
fix: wrong device selection inside topBar
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyco97 committed Jan 9, 2025
1 parent 7060a18 commit eff5eb7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions components/layout/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const TopBar: FC<TopBarProps> = ({ openMobileCb }) => {
// also filter all the device except the mobile one
useEffect(() => {
if (profile?.endpoints) {
let extensionObj: any = profile.endpoints
let extensionObj: any = profile?.endpoints
if (profile?.default_device?.id && !isEmpty(extensionObj)) {
const extensionType = extensionObj.extension.find(
(ext: any) => ext.id === profile?.default_device?.id,
Expand Down Expand Up @@ -438,12 +438,19 @@ export const TopBar: FC<TopBarProps> = ({ openMobileCb }) => {
(defaultType === 'webrtc' && device?.type === 'nethlink') ||
(defaultType === 'physical' &&
device?.type === 'webrtc' &&
phoneLinkData?.length >= 1) ||
phoneLinkData?.length >= 1 &&
phoneLinkData[0]?.id !== '' &&
!isEmpty(operatorsStore) &&
operatorsStore?.extensions[phoneLinkData[0]?.id]?.status ===
'online') ||
// Hide nethlink choose only if there isn't a nethLink device or webrtc device is the default one
(defaultType === 'nethlink' && device?.type === 'webrtc') ||
(defaultType === 'physical' &&
device?.type === 'nethlink' &&
phoneLinkData?.length < 1)
phoneLinkData?.length >= 1 &&
device?.id !== '' &&
!isEmpty(operatorsStore) &&
operatorsStore?.extensions[device?.id]?.status === 'offline')
) {
return false
}
Expand Down

0 comments on commit eff5eb7

Please sign in to comment.