@@ -457,26 +457,28 @@ class ApiMethods {
457
457
} ;
458
458
459
459
logout = async ( ) : Promise < void > => {
460
- try {
461
- // Fetch the stored ID token from the backend
462
- const response = await this . axios . get ( "/api/v2/users/oidc-logout" ) ;
463
-
464
- // Redirect to OIDC logout after Coder logout
465
- if ( response . data . oidc_logout_url ) {
466
- // Coder session logout
467
- await this . axios . post ( "/api/v2/users/logout" ) ;
468
-
469
- // OIDC logout
470
- window . location . href = response . data . oidc_logout_url ;
471
- } else {
472
- // Redirect normally if no token is available
473
- console . warn ( "No ID token found, continuing logout without OIDC logout." ) ;
474
- return this . axios . post ( "/api/v2/users/logout" ) ;
475
- }
476
- } catch ( error ) {
477
- console . error ( "Logout failed" , error ) ;
478
- return this . axios . post ( "/api/v2/users/logout" ) ;
479
- }
460
+ try {
461
+ // Fetch the stored ID token from the backend
462
+ const response = await this . axios . get ( "/api/v2/users/oidc-logout" ) ;
463
+
464
+ // Redirect to OIDC logout after Coder logout
465
+ if ( response . data . oidc_logout_url ) {
466
+ // Coder session logout
467
+ await this . axios . post ( "/api/v2/users/logout" ) ;
468
+
469
+ // OIDC logout
470
+ window . location . href = response . data . oidc_logout_url ;
471
+ } else {
472
+ // Redirect normally if no token is available
473
+ console . warn (
474
+ "No ID token found, continuing logout without OIDC logout." ,
475
+ ) ;
476
+ return this . axios . post ( "/api/v2/users/logout" ) ;
477
+ }
478
+ } catch ( error ) {
479
+ console . error ( "Logout failed" , error ) ;
480
+ return this . axios . post ( "/api/v2/users/logout" ) ;
481
+ }
480
482
} ;
481
483
482
484
getAuthenticatedUser = async ( ) => {
0 commit comments