Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions app/(auth)/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
import { useRouter } from 'expo-router';
import { ChevronLeft, Camera, AlertCircle, X } from 'lucide-react-native';
import { colors } from '../../constants/colors';
import { Button } from '../../components/shared/Button';

Check warning on line 14 in app/(auth)/register.tsx

View workflow job for this annotation

GitHub Actions / Lint / Typecheck / Test

'Button' is defined but never used

Check warning on line 14 in app/(auth)/register.tsx

View workflow job for this annotation

GitHub Actions / Lint / Typecheck / Test

'Button' is defined but never used
import { Input } from '../../components/shared/Input';
import { useUserStore } from '../../stores/user.store';
import { useAuthStore } from '../../stores/auth.store';
import { useWalletStore } from '../../stores/wallet.store';
import { authService } from '../../services/auth.service';
import { useTranslation } from '../../hooks/useTranslation';
import type { LearnerProfile } from '../../types/user.types';

Expand All @@ -27,6 +28,8 @@
const setTokens = useAuthStore((s) => s.setTokens);
const setWallet = useAuthStore((s) => s.setWallet);
const publicKey = useWalletStore((s) => s.address);
const walletType = useWalletStore((s) => s.walletType);
const sessionId = useWalletStore((s) => s.sessionId);

const [displayName, setDisplayName] = useState('');
const [isSubmitting, setIsSubmitting] = useState(false);
Expand All @@ -49,12 +52,16 @@

const handleComplete = async () => {
if (!isValid) return;
if (!publicKey || !walletType) {
setSubmitError('No wallet connected. Please connect your wallet and try again.');
return;
}
setIsSubmitting(true);
setSubmitError(null);

try {
const profile: LearnerProfile = {
walletAddress: publicKey ?? '',
walletAddress: publicKey,
displayName: displayName.trim(),
role: role ?? 'learner',
school: isLearner ? school.trim() : undefined,
Expand All @@ -66,8 +73,11 @@

setProfile(profile);

await setTokens('mock-access-token', 'mock-refresh-token');
await setWallet(publicKey ?? '');
// Real wallet-signature auth: sign the SEP-10-style challenge with the
// connected wallet and exchange it for JWT tokens.
const tokens = await authService.authenticate(publicKey, walletType, sessionId);
await setTokens(tokens.accessToken, tokens.refreshToken);
await setWallet(publicKey);
} catch (err) {
console.error('[register] failed to complete registration', err);
const message =
Expand Down
146 changes: 0 additions & 146 deletions components/pages/SignIn.tsx

This file was deleted.

130 changes: 0 additions & 130 deletions hooks/auth/use-sign-in.ts

This file was deleted.

Loading
Loading