diff --git a/packages/react/components/SignIn/index.mjs b/packages/react/components/SignIn/index.mjs
index 0eb1e8975b4..fe2dd641e69 100644
--- a/packages/react/components/SignIn/index.mjs
+++ b/packages/react/components/SignIn/index.mjs
@@ -30,11 +30,18 @@ import { MfaInput, StringInput, PasswordInput } from '@freesewing/react/componen
import { H1, H2, H3, H4 } from '@freesewing/react/components/Heading'
/*
- * This SignIn component holds the entire sign-in form
*
* @param {object} props - All React props
- * @param {function} props.onSuccess - Optional: A method to run when the sign in is successful
- * @param {function} props.silent - Optional: Silently login the user if we have a valid session
+ */
+
+/**
+ * The SignIn component holds the entire sign-in form
+ *
+ * @component
+ * @param {object} props - All component props
+ * @param {function} [props.onSuccess = false] - A method to run when the sign in is successful
+ * @param {boolean} [props.silent] - Silently login the user if we have a valid session
+ * @returns {JSX.Element}
*/
export const SignIn = ({ onSuccess = false, silent = false }) => {
const { account, setAccount, setToken, seenUser, setSeenUser } = useAccount()
@@ -331,6 +338,14 @@ const MfaForm = ({ mfaCode, setMfaCode, onSubmit, post = [] }) => (
)
+/**
+ * A component to handle the confirmation URL for a passwordless login link (aka magic link).
+ *
+ * @component
+ * @param {object} props - All component props
+ * @param {function} [props.onSuccess = false] - A method to run when the sign in is successful
+ * @returns {JSX.Element}
+ */
export const SignInConfirmation = ({ onSuccess = false }) => {
// State
const [error, setError] = useState(false)
@@ -349,6 +364,7 @@ export const SignInConfirmation = ({ onSuccess = false }) => {
// Effects
useEffect(() => {
const newId = getSearchParam('id')
+ if (!newId) setError('noId')
const newCheck = getSearchParam('check')
if (newId !== id) setId(newId)
if (newCheck !== check) setCheck(newCheck)
@@ -396,6 +412,7 @@ export const SignInConfirmation = ({ onSuccess = false }) => {
}
// Short-circuit errors
+ if (error === 'noId') return
fixme
} - -/* - * This is the generic component that will handle the Oauth callback - */ -export const OauthCallback = ({ provider = false }) => { - const [error, setError] = useState(false) - const backend = useBackend() - const { setAccount, setToken, setSeenUser } = useAccount() - - // Handle callback - useEffect(() => { - const oauthFlow = async () => { - const state = getSearchParam('state') - const code = getSearchParam('state') - const [status, body] = await backend.oauthSignIn({ state, code, provider }) - if (status === 200 && body.account && body.token) { - setAccount(body.account) - setToken(body.token) - setSeenUser(body.data.account.username) - navigate('/welcome', true) - } else setError(true) - } - oauthFlow() - }, []) - - if (!provider) returnYou must provide a provider prop to this component
- - return error ? ( - <> -- Please{' '} - - escalate this to support - -
- > - ) : ( - <> -