Download wp-calypso/client/lib/auth-helper/index.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 976 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/auth-helper/index.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/lib/auth-helper/index.jsx
-
curl -L -o index.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/auth-helper/index.jsx
976 Bytes
| import config from '@automattic/calypso-config'; | |
| import { createRoot } from 'react-dom/client'; | |
| import './style.scss'; | |
| function AuthHelper() { | |
| const isOAuth = config.isEnabled( 'oauth' ); | |
| function setAuth( event ) { | |
| const value = event.currentTarget.value; | |
| window.location.href = '?' + new URLSearchParams( { flags: value } ).toString(); | |
| } | |
| return ( | |
| <> | |
| <div>Auth: { isOAuth ? 'OAuth' : 'Cookies' }</div> | |
| <div className="auth-helper__popover"> | |
| <label className="auth-helper__label"> | |
| <input | |
| type="radio" | |
| name="auth" | |
| value="-oauth" | |
| defaultChecked={ ! isOAuth } | |
| onChange={ setAuth } | |
| /> | |
| Cookies | |
| </label> | |
| <label className="auth-helper__label"> | |
| <input | |
| type="radio" | |
| name="auth" | |
| value="oauth" | |
| defaultChecked={ isOAuth } | |
| onChange={ setAuth } | |
| /> | |
| OAuth | |
| </label> | |
| </div> | |
| </> | |
| ); | |
| } | |
| export default ( element ) => createRoot( element ).render( <AuthHelper /> ); | |