import { useState } from 'react'; import { View, Text, TextInput, TouchableOpacity, ActivityIndicator, Alert, KeyboardAvoidingView, Platform } from 'react-native'; import { router } from 'expo-router'; import { api } from '../../services/api'; export default function CompanyCodeScreen() { const [slug, setSlug] = useState(''); const [loading, setLoading] = useState(false); const handleContinue = async () => { if (!slug.trim()) return Alert.alert('Required', 'Please enter your company code.'); setLoading(true); try { const res = await api.get(`/api/v1/auth/tenant/${slug.trim().toLowerCase()}/exists`); if (res.data?.exists) { router.push({ pathname: '/(auth)/login', params: { tenantSlug: slug.trim().toLowerCase() } }); } else { Alert.alert('Not Found', 'Company code not found. Please check and try again.'); } } catch { Alert.alert('Error', 'Could not verify company code. Please try again.'); } finally { setLoading(false); } }; return ( F FiberOps Field Operations Enter Company Code Ask your admin for your company's unique code. {loading ? ( ) : ( Continue )} ); }