diff --git a/web/src/apps/settings/WifiTab.vue b/web/src/apps/settings/WifiTab.vue index 5523a14..1e20448 100644 --- a/web/src/apps/settings/WifiTab.vue +++ b/web/src/apps/settings/WifiTab.vue @@ -44,11 +44,10 @@ const connect = async (ssid: string, password?: string) => { const { success, error } = data.value as ConnectionResponse - bus.emit('updated') - isConnecting.value = false if (!success) { + bus.emit('updated') return notif.show({ summary: locale.t('settings_wifi_connection_error'), detail: error! @@ -57,6 +56,7 @@ const connect = async (ssid: string, password?: string) => { connection.markAsConnected(ssid) + bus.emit('updated') notif.show({ summary: locale.t('settings_wifi_connection_succ'), detail: `${locale.t('settings_wifi_connected_to')}${ssid}` @@ -122,11 +122,10 @@ const disconnect = async () => { const { success, error } = data.value as ConnectionResponse - bus.emit('updated') - isConnecting.value = false if (!success) { + bus.emit('updated') notif.show({ summary: locale.t('settings_wifi_connection_error'), detail: error! @@ -136,6 +135,7 @@ const disconnect = async () => { connection.markAsDisconnected() connection.connectedToVpn = false + bus.emit('updated') notif.show({ summary: locale.t('settings_wifi_disconnect_succ'), detail: locale.t('settings_wifi_disconnect_succ_detail') @@ -160,14 +160,15 @@ const toggleVpn = async (status: boolean) => { const { success } = data.value as ConnectionResponse - bus.emit('updated') - if (!success) { connection.connectedToVpn = false + bus.emit('updated') return } + bus.emit('updated') + notif.show({ summary: 'VPN connection', detail: status ? locale.t('settings_wifi_vpn_enabled') : locale.t('settings_wifi_vpn_disabled') @@ -185,6 +186,8 @@ watchDebounced( watchDebounced( () => connection.airplaneMode, (value) => { + bus.emit('updated') + if (value) { disconnect() diff --git a/web/src/stores/connection.store.ts b/web/src/stores/connection.store.ts index f7b3275..bba278a 100644 --- a/web/src/stores/connection.store.ts +++ b/web/src/stores/connection.store.ts @@ -38,7 +38,7 @@ export const useConnection = defineStore('wifi', () => { const forApps = computed(() => ({ isConnected: isConnected.value, - connectedTo: connectedTo.value, + connectedTo: connectedTo.value !== undefined ? JSON.parse(JSON.stringify(connectedTo.value)) : undefined, airplaneMode: airplaneMode.value, connectedToVpn: connectedToVpn.value }))