Conversation
Bccorb
left a comment
There was a problem hiding this comment.
The code needs to be cleaned up. Remove comments and ensure logs are cleaned up and function returns are standardized.
src/views/Login.tsx
Outdated
| setShowFallbackOptions(true); | ||
| } | ||
| }; | ||
| // const handlePasskeyLogin = async () => { |
There was a problem hiding this comment.
Get rid of the commented out code.
src/views/Login.tsx
Outdated
|
|
||
| if (mode === 'login') login(); | ||
| if (mode === 'login') { | ||
| login(identifier, passkeyAvailable); |
There was a problem hiding this comment.
You need to wait for the response of this and validate it is correct before trying to do passkey login.
src/AuthProvider.tsx
Outdated
| if (!passkeyAvailable) { | ||
| // setShowFallbackOptions(true); | ||
| return response; | ||
| } | ||
|
|
||
| try { | ||
| return response; | ||
| } catch (err) { | ||
| console.error('Passkey login failed', err); | ||
| // setShowFallbackOptions(true); | ||
| return response; | ||
| } |
There was a problem hiding this comment.
Idk if you need any of this?
There was a problem hiding this comment.
I was always told to try any api request. But I couldn't catch and return the response so I'll just remove the try for now.
src/AuthProvider.tsx
Outdated
| // navigate('/mfaLogin'); | ||
| // need to return "Success" | ||
| // can just return a bool, if success true otherwise false anywhere else | ||
| return true; |
There was a problem hiding this comment.
Get rid of the commented out code
src/views/VerifyMagicLink.tsx
Outdated
| return; | ||
| } | ||
| } catch (error) { | ||
| console.log(error); |
There was a problem hiding this comment.
Change this to a console.error instead of console.log.
Summary
Describe the change.
Moved login function and handlepasskey function logic to be importable to allow front end dev to decide how to handle the responses.
Type of Change
Checklist