File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
app/commonComponents/Navigation Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ import {
3535import { faDiscord , faGithub } from "@fortawesome/free-brands-svg-icons" ;
3636
3737import { classnames } from "@thunderstore/cyberstorm/src/utils/utils" ;
38- import { buildAuthLoginUrl } from "cyberstorm/utils/ThunderstoreAuth" ;
38+ import {
39+ buildAuthLoginUrl ,
40+ buildLogoutUrl ,
41+ } from "cyberstorm/utils/ThunderstoreAuth" ;
3942import { faArrowUpRight } from "@fortawesome/pro-solid-svg-icons" ;
4043import { getPublicEnvVariables } from "cyberstorm/security/publicEnvVariables" ;
4144
@@ -404,7 +407,7 @@ export function DesktopUserDropdown(props: {
404407 < NewDropDownItem asChild >
405408 < NewLink
406409 primitiveType = "link"
407- href = { ` ${ domain } /logout/` }
410+ href = { buildLogoutUrl ( domain ) }
408411 rootClasses = "dropdown__item navigation-header__dropdown-item"
409412 >
410413 < NewIcon csMode = "inline" noWrapper csVariant = "tertiary" >
@@ -566,7 +569,7 @@ export function MobileUserPopoverContent(props: {
566569 </ NewLink >
567570 < NewLink
568571 primitiveType = "link"
569- href = { domain ? ` ${ domain } /logout/` : "/logout" }
572+ href = { buildLogoutUrl ( domain ) }
570573 rootClasses = "mobile-navigation__popover-item mobile-navigation__popover--thick"
571574 >
572575 < NewIcon csMode = "inline" noWrapper >
Original file line number Diff line number Diff line change 1- interface Props {
1+ import { getPublicEnvVariables } from "cyberstorm/security/publicEnvVariables" ;
2+
3+ interface LoginProps {
24 type : "discord" | "github" | "overwolf" ;
35 authBaseDomain : string ;
46 authReturnDomain : string ;
57 nextUrl ?: string ;
68}
79
8- export function buildAuthLoginUrl ( props : Props ) {
10+ export function buildAuthLoginUrl ( props : LoginProps ) {
911 return `${ props . authBaseDomain } /auth/login/${ props . type } /${
1012 props . nextUrl
1113 ? `?next=${ encodeURIComponent ( props . nextUrl ) } `
1214 : `?next=${ encodeURIComponent ( `${ props . authReturnDomain } /communities/` ) } `
1315 } `;
1416}
17+
18+ export function buildLogoutUrl ( domain ?: string ) {
19+ const publicEnvVariables = getPublicEnvVariables ( [ "VITE_AUTH_RETURN_URL" ] ) ;
20+ const returnURL = publicEnvVariables . VITE_AUTH_RETURN_URL || "" ;
21+ const logoutURL = domain ? `${ domain } /logout/` : "/logout" ;
22+ return `${ logoutURL } ?next=${ encodeURIComponent ( returnURL ) } ` ;
23+ }
You can’t perform that action at this time.
0 commit comments