File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed
Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,18 @@ export class AccountController {
4040 }
4141
4242 async logout ( ) {
43+ // Call API logout before clearing local data
44+ const account = store . store . account
45+ if ( account ) {
46+ try {
47+ const { NethVoiceAPI } = useNethVoiceAPI ( account )
48+ await NethVoiceAPI . Authentication . logout ( )
49+ Log . info ( 'AccountController.logout() - logout API call completed successfully' )
50+ } catch ( e ) {
51+ Log . warning ( 'Error calling logout API:' , e )
52+ }
53+ }
54+
4355 store . updateStore ( {
4456 auth : {
4557 ...store . store . auth ! ,
Original file line number Diff line number Diff line change @@ -355,14 +355,19 @@ function attachOnReadyProcess() {
355355 }
356356
357357 const account : Account = store . get ( 'account' ) as Account
358- const ext = account . data ?. endpoints . extension . find ( ( e ) => e . type === "webrtc" )
359358
360- if ( ext && account ?. data ?. default_device ?. type !== 'physical' ) {
361- const { NethVoiceAPI } = useNethVoiceAPI ( account )
362- const res = await NethVoiceAPI . User . default_device ( ext )
363- Log . info ( 'Reset device' , res , ext . type , ext . id )
359+ if ( account ?. data ) {
360+ const ext = account . data . endpoints . extension . find ( ( e ) => e . type === "webrtc" )
361+
362+ if ( ext && account . data . default_device ?. type !== 'physical' ) {
363+ const { NethVoiceAPI } = useNethVoiceAPI ( account )
364+ const res = await NethVoiceAPI . User . default_device ( ext )
365+ Log . info ( 'Reset device' , res , ext . type , ext . id )
366+ } else {
367+ Log . info ( 'No device to reset' )
368+ }
364369 } else {
365- Log . info ( 'No device to reset' )
370+ Log . info ( 'No account logged in, skipping device reset' )
366371 }
367372
368373 // read shortcut from config and unregister
You can’t perform that action at this time.
0 commit comments