File tree Expand file tree Collapse file tree 1 file changed +27
-12
lines changed
react-static-web-apps-auth/src Expand file tree Collapse file tree 1 file changed +27
-12
lines changed Original file line number Diff line number Diff line change 11import React from "react" ;
22import { StaticWebAppsClassName } from "./constants" ;
33
4- const Logout = ( { postLogoutRedirect } : { postLogoutRedirect ?: string } ) => (
5- < a
6- href = { `/.auth/logout${
7- postLogoutRedirect
8- ? `?post_logout_redirect_uri=${ postLogoutRedirect } `
9- : ""
10- } `}
11- className = { `logout ${ StaticWebAppsClassName } ` }
12- >
13- Logout
14- </ a >
15- ) ;
4+ export type RenderLogoutProps = {
5+ href : string ;
6+ className : string ;
7+ } ;
8+
9+ const Logout = ( {
10+ postLogoutRedirect,
11+ customRenderer,
12+ } : {
13+ postLogoutRedirect ?: string ;
14+ customRenderer ?: ( props : RenderLogoutProps ) => JSX . Element ;
15+ } ) => {
16+ const href = `/.auth/logout${
17+ postLogoutRedirect ? `?post_logout_redirect_uri=${ postLogoutRedirect } ` : ""
18+ } `;
19+ const className = `logout ${ StaticWebAppsClassName } ` ;
20+
21+ if ( customRenderer ) {
22+ return customRenderer ( { href, className } ) ;
23+ }
24+
25+ return (
26+ < a href = { href } className = { className } >
27+ Logout
28+ </ a >
29+ ) ;
30+ } ;
1631
1732export { Logout } ;
You can’t perform that action at this time.
0 commit comments