@@ -430,26 +430,28 @@ class ApiMethods {
430
430
} ;
431
431
432
432
logout = async ( ) : Promise < void > => {
433
- try {
434
- // Fetch the stored ID token from the backend
435
- const response = await this . axios . get ( "/api/v2/users/oidc-logout" ) ;
436
-
437
- // Redirect to OIDC logout after Coder logout
438
- if ( response . data . oidc_logout_url ) {
439
- // Coder session logout
440
- await this . axios . post ( "/api/v2/users/logout" ) ;
441
-
442
- // OIDC logout
443
- window . location . href = response . data . oidc_logout_url ;
444
- } else {
445
- // Redirect normally if no token is available
446
- console . warn ( "No ID token found, continuing logout without OIDC logout." ) ;
447
- return this . axios . post ( "/api/v2/users/logout" ) ;
448
- }
449
- } catch ( error ) {
450
- console . error ( "Logout failed" , error ) ;
451
- return this . axios . post ( "/api/v2/users/logout" ) ;
452
- }
433
+ try {
434
+ // Fetch the stored ID token from the backend
435
+ const response = await this . axios . get ( "/api/v2/users/oidc-logout" ) ;
436
+
437
+ // Redirect to OIDC logout after Coder logout
438
+ if ( response . data . oidc_logout_url ) {
439
+ // Coder session logout
440
+ await this . axios . post ( "/api/v2/users/logout" ) ;
441
+
442
+ // OIDC logout
443
+ window . location . href = response . data . oidc_logout_url ;
444
+ } else {
445
+ // Redirect normally if no token is available
446
+ console . warn (
447
+ "No ID token found, continuing logout without OIDC logout." ,
448
+ ) ;
449
+ return this . axios . post ( "/api/v2/users/logout" ) ;
450
+ }
451
+ } catch ( error ) {
452
+ console . error ( "Logout failed" , error ) ;
453
+ return this . axios . post ( "/api/v2/users/logout" ) ;
454
+ }
453
455
} ;
454
456
455
457
getAuthenticatedUser = async ( ) => {
0 commit comments