Function
GitHubButton
({
flow,
callbackUrl,
state,
sso,
redirectFn,
origin,
}: {
flow: 'sign-in' | 'sign-up';
callbackUrl?: string;
state?: string;
sso?: string;
redirectFn?(url: string): void;
origin?: string;
})
Source from the content-addressed store, hash-verified
| 5 | import styles from './index.module.scss'; |
| 6 | |
| 7 | export default function GitHubButton({ |
| 8 | flow, |
| 9 | callbackUrl, |
| 10 | state, |
| 11 | sso, |
| 12 | redirectFn, |
| 13 | origin, |
| 14 | }: { |
| 15 | flow: 'sign-in' | 'sign-up'; |
| 16 | callbackUrl?: string; |
| 17 | state?: string; |
| 18 | sso?: string; |
| 19 | redirectFn?(url: string): void; |
| 20 | origin?: string; |
| 21 | }) { |
| 22 | return ( |
| 23 | <Button |
| 24 | block={true} |
| 25 | onClick={(e: any) => { |
| 26 | e.preventDefault(); |
| 27 | const url = `/api/auth/github?${qs({ |
| 28 | callbackUrl, |
| 29 | state, |
| 30 | origin: origin || window.location.origin, |
| 31 | sso, |
| 32 | })}`; |
| 33 | if (redirectFn) { |
| 34 | redirectFn(url); |
| 35 | } else { |
| 36 | window.location.href = url; |
| 37 | } |
| 38 | }} |
| 39 | color="black" |
| 40 | > |
| 41 | <div className={styles.btn}> |
| 42 | <GoMarkGithub /> |
| 43 | <span>Sign {flow === 'sign-in' ? 'in' : 'up'} with GitHub</span> |
| 44 | </div> |
| 45 | </Button> |
| 46 | ); |
| 47 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected