Skip to content

Commit e5b44fa

Browse files
committed
cleaned and removed lint warnings
1 parent ab921eb commit e5b44fa

3 files changed

Lines changed: 2 additions & 89 deletions

File tree

src/AuthProvider.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,10 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({
110110
});
111111
if (!passkeyAvailable) {
112112
// setShowFallbackOptions(true);
113-
console.log('stopped early');
114113
return response;
115114
}
116115

117116
try {
118-
// await handlePasskeyLogin();
119-
// Another ticket?
120117
return response;
121118
} catch (err) {
122119
console.error('Passkey login failed', err);

src/utils.ts

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import parsePhoneNumberFromString from 'libphonenumber-js';
2-
import { startAuthentication } from '@simplewebauthn/browser';
3-
import { createFetchWithAuth } from './fetchWithAuth';
42
/**
53
* isValidEmail
64
*
@@ -102,78 +100,3 @@ export function parseUserAgent() {
102100

103101
return { platform, browser, deviceInfo };
104102
}
105-
106-
// export const login = async (
107-
// fetchWithAuth: (input: string, init?: RequestInit) => Promise<Response>,
108-
// identifier: string,
109-
// passkeyAvailable: boolean
110-
// ) => {
111-
// // setFormErrors('');
112-
113-
// const response = await fetchWithAuth(`/login`, {
114-
// method: 'POST',
115-
// body: JSON.stringify({ identifier, passkeyAvailable }),
116-
// });
117-
// console.log('response from /login', response);
118-
// // if (!response.ok) {
119-
// // setFormErrors('Failed to send login link. Please try again.');
120-
// // return;
121-
// // }
122-
123-
// if (!passkeyAvailable) {
124-
// // setShowFallbackOptions(true);
125-
// console.log
126-
// return;
127-
// }
128-
129-
// try {
130-
// await handlePasskeyLogin(fetchWithAuth);
131-
// } catch (err) {
132-
// console.error('Passkey login failed', err);
133-
// // setShowFallbackOptions(true);
134-
// }
135-
// };
136-
137-
const handlePasskeyLogin = async (
138-
fetchWithAuth: (input: string, init?: RequestInit) => Promise<Response>
139-
) => {
140-
try {
141-
const response = await fetchWithAuth(`/webAuthn/login/start`, {
142-
method: 'POST',
143-
});
144-
145-
if (!response.ok) {
146-
console.error('Something went wrong getting webauthn options');
147-
return;
148-
}
149-
150-
const options = await response.json();
151-
const credential = await startAuthentication({ optionsJSON: options });
152-
153-
const verificationResponse = await fetchWithAuth(`/webAuthn/login/finish`, {
154-
method: 'POST',
155-
body: JSON.stringify({ assertionResponse: credential }),
156-
});
157-
158-
if (!verificationResponse.ok) {
159-
console.error('Failed to verify passkey');
160-
}
161-
162-
const verificationResult = await verificationResponse.json();
163-
164-
// let them handle the below
165-
// if (verificationResult.message === 'Success') {
166-
// if (verificationResult.mfaLogin) {
167-
// navigate('/mfaLogin');
168-
// return;
169-
// }
170-
// await validateToken();
171-
// navigate('/');
172-
// return;
173-
// } else {
174-
// console.error('Passkey login failed:', verificationResult.message);
175-
// }
176-
} catch (error) {
177-
console.error('Passkey login error:', error);
178-
}
179-
};

src/views/Login.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { startAuthentication } from '@simplewebauthn/browser';
21
import { useAuth } from '@/AuthProvider';
32
import PhoneInputWithCountryCode from '@/components/phoneInput';
4-
import { useInternalAuth } from '@/context/InternalAuthContext';
53
import React, { useEffect, useState } from 'react';
64
import { useNavigate } from 'react-router-dom';
75
import styles from '@/styles/login.module.css';
@@ -18,7 +16,6 @@ const Login: React.FC = () => {
1816
login,
1917
handlePasskeyLogin,
2018
} = useAuth();
21-
const { validateToken } = useInternalAuth();
2219
const [identifier, setIdentifier] = useState<string>('');
2320
const [email, setEmail] = useState<string>('');
2421
const [mode, setMode] = useState<'login' | 'register'>('register');
@@ -38,9 +35,7 @@ const Login: React.FC = () => {
3835
useEffect(() => {
3936
async function checkSupport() {
4037
const supported = await isPasskeySupported();
41-
// console.log('checking passkey', supported);
4238
setPasskeyAvailable(supported);
43-
console.log('checking passkey', supported);
4439
}
4540

4641
checkSupport();
@@ -150,7 +145,7 @@ const Login: React.FC = () => {
150145
return;
151146
}
152147

153-
navigate('/magic-links-sent');
148+
navigate('/magiclinks-sent');
154149
} catch (err) {
155150
console.error(err);
156151
setFormErrors('Failed to send magic link.');
@@ -180,17 +175,15 @@ const Login: React.FC = () => {
180175
e.preventDefault();
181176

182177
if (mode === 'login') {
183-
const res = login(identifier, passkeyAvailable);
178+
login(identifier, passkeyAvailable);
184179

185180
if (passkeyAvailable) {
186-
console.log('herro');
187181
const passkeyResult = await handlePasskeyLogin();
188182
if (passkeyResult) {
189183
navigate('/');
190184
}
191185
} else {
192186
setShowFallbackOptions(true);
193-
console.log(setShowFallbackOptions);
194187
}
195188
}
196189
if (mode === 'register') register();

0 commit comments

Comments
 (0)