Skip to content

Commit 5756f2a

Browse files
tommaso-ascaniedospadoni
authored andcommitted
feat: update logout functionality to use new API endpoints
1 parent 595f845 commit 5756f2a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/classes/controllers/AccountController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export class AccountController {
4545
if (account) {
4646
try {
4747
const { NethVoiceAPI } = useNethVoiceAPI(account)
48+
await NethVoiceAPI.Authentication.phoneIslandTokenLogout()
4849
await NethVoiceAPI.Authentication.logout()
4950
Log.info('AccountController.logout() - logout API call completed successfully')
5051
} catch (e) {

src/shared/useNethVoiceAPI.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const useNethVoiceAPI = (loggedAccount: Account | undefined = undefined)
4343
if (endpoint === '/login') {
4444
return `${FALLBACK_API_BASE_PATH}/authentication/login`
4545
}
46-
if (endpoint === '/authentication/logout') {
46+
if (endpoint === '/logout') {
4747
return `${FALLBACK_API_BASE_PATH}/authentication/logout`
4848
}
4949
if (endpoint === '/authentication/phone_island_token_login') {
@@ -378,7 +378,7 @@ export const useNethVoiceAPI = (loggedAccount: Account | undefined = undefined)
378378
isFirstHeartbeat = false
379379
return new Promise<void>(async (resolve) => {
380380
try {
381-
await _POST(buildApiPath('/authentication/logout'), {})
381+
await _POST(buildApiPath('/logout'))
382382
} catch (e) {
383383
Log.warning("error during logout:", e)
384384
} finally {
@@ -394,6 +394,9 @@ export const useNethVoiceAPI = (loggedAccount: Account | undefined = undefined)
394394

395395
phoneIslandTokenLogin: async (): Promise<{ username: string, token: string }> =>
396396
await _POST(buildApiPath('/authentication/phone_island_token_login'), { subtype: 'nethlink' }),
397+
398+
phoneIslandTokenLogout: async (): Promise<{ username: string, token: string }> =>
399+
await _POST(buildApiPath('/authentication/persistent_token_remove'), { type: 'phone-island', subtype: 'nethlink' }),
397400
}
398401

399402
const CustCard = {}

0 commit comments

Comments
 (0)