Skip to content

Commit d363041

Browse files
committed
fixup! feat: logout app subdomains on logout button
1 parent 7d6959a commit d363041

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

site/src/xServices/auth/authXService.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,15 +473,18 @@ export const authMachine =
473473
// Get app hostname so we can see if we need to log out of app URLs.
474474
// We need to load this before we log out of the API as this is an
475475
// authenticated endpoint.
476-
const appHost = await API.getApplicationsHost();
477-
await API.logout();
476+
const appHost = await API.getApplicationsHost()
477+
await API.logout()
478478

479479
if (appHost.host) {
480-
const redirect_uri = encodeURIComponent(window.location.href);
480+
const redirect_uri = encodeURIComponent(window.location.href)
481481
// The path doesn't matter but we use /api because the dev server
482482
// proxies /api to the backend.
483-
const uri = `${window.location.protocol}//${appHost.host.replace("*", "coder-logout")}/api/logout?redirect_uri=${redirect_uri}`;
484-
window.location.replace(uri);
483+
const uri = `${window.location.protocol}//${appHost.host.replace(
484+
"*",
485+
"coder-logout",
486+
)}/api/logout?redirect_uri=${redirect_uri}`
487+
window.location.replace(uri)
485488
}
486489
},
487490
getMe: API.getUser,

0 commit comments

Comments
 (0)