Skip to content

Commit

Permalink
fix: WiFi connection status not being replicated when connected netwo…
Browse files Browse the repository at this point in the history
…rk is removed via `removeNetwork`. (#4)
  • Loading branch information
gamenew09 authored Oct 18, 2024
1 parent 621b3ce commit d9d0ac9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions web/src/stores/connection.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ useNuiEvent<WifiNetwork>('addNetwork', (data: WifiNetwork) => {
useNuiEvent<string>('removeNetwork', (ssid: string) => {
const connection = useConnection()

const oldConnections = connection.networks
connection.networks = connection.networks.filter((network) => network.ssid !== ssid)

// Check to see if the networks array was changed via the filter operation.
// If it was, let the network event bus be aware of this change.
if(oldConnections.length !== connection.networks.length) {
const networkBus = useEventBus('network')
networkBus.emit('updated')
}
})

useNuiEvent<string>('connect', (ssid: string) => {
Expand Down

0 comments on commit d9d0ac9

Please sign in to comment.