enh
This commit is contained in:
parent
88985c9572
commit
a16e50c6a5
27 changed files with 8 additions and 79 deletions
|
|
@ -184,8 +184,6 @@ function Login() {
|
|||
const mobile = data.mobile.trim();
|
||||
// Validate mobile number
|
||||
if (!mobile) {
|
||||
console.log('no mobile number found')
|
||||
|
||||
setError("mobile", {
|
||||
type: "manual",
|
||||
message: "Mobile number is required",
|
||||
|
|
@ -229,8 +227,6 @@ function Login() {
|
|||
}
|
||||
|
||||
try {
|
||||
console.log('calling the login function')
|
||||
|
||||
const response = await loginMutation.mutateAsync({
|
||||
identifier: selectedMobile,
|
||||
password: data.password,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ function Register() {
|
|||
await register(formData);
|
||||
// Auth context will handle navigation on successful registration
|
||||
} catch (error: any) {
|
||||
console.error('Registration error:', error);
|
||||
Alert.alert(
|
||||
'Registration Failed',
|
||||
error.message || 'Failed to create account. Please try again.'
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import FontAwesome5 from '@expo/vector-icons/FontAwesome5';
|
|||
|
||||
export default function About() {
|
||||
const openLink = (url: string) => {
|
||||
Linking.openURL(url).catch((err) => console.error("Couldn't load page", err));
|
||||
Linking.openURL(url).catch((err) => {});
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -130,9 +130,6 @@ export default function Coupons() {
|
|||
refetch();
|
||||
});
|
||||
|
||||
console.log({data, error})
|
||||
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<AppContainer>
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ function EditProfile() {
|
|||
// Navigate back to profile/me page
|
||||
router.replace('/(drawer)/(tabs)/me');
|
||||
} catch (error) {
|
||||
JSON.stringify(error);
|
||||
console.error('Update profile error:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ export default function Me() {
|
|||
|
||||
useFocusEffect(() => {
|
||||
const target = getNavigationTarget();
|
||||
console.log({target})
|
||||
|
||||
if (target) {
|
||||
router.replace(target as any);
|
||||
|
|
|
|||
|
|
@ -50,8 +50,6 @@ export default function OrderDetails() {
|
|||
Alert.alert('Success', 'Order cancelled successfully');
|
||||
},
|
||||
onError: (error: any) => {
|
||||
console.log({error})
|
||||
|
||||
Alert.alert('Error', error.message || 'Failed to cancel order');
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
export async function GET(request:Request) {
|
||||
console.log('from the get token request')
|
||||
|
||||
}
|
||||
|
|
@ -16,7 +16,5 @@ export default function Index() {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
console.log("from the user ui index.tsx - isAuthenticated:", isAuthenticated);
|
||||
return <Redirect href="/(drawer)/(tabs)/home" />;
|
||||
}
|
||||
|
|
@ -66,7 +66,6 @@ export default function BannerCarousel() {
|
|||
router.push(`/(drawer)/(tabs)/home/product-detail/${banner.productIds[0]}`);
|
||||
} else if (banner.redirectUrl) {
|
||||
// Handle external URL - could open in browser or handle deep links
|
||||
console.log('Banner redirect URL:', banner.redirectUrl);
|
||||
}
|
||||
// If no productIds or redirectUrl, banner is just for display
|
||||
};
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ const HealthTestWrapper: React.FC<HealthTestWrapperProps> = ({ children }) => {
|
|||
}
|
||||
}, [versionFromBackend]);
|
||||
|
||||
// Log app version
|
||||
console.log('App Version:', Constants.expoConfig?.version);
|
||||
console.log('Backend Version:', versionFromBackend);
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View style={tw`flex-1 justify-center items-center bg-gray-50`}>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ const isEmulator = (): boolean => {
|
|||
return false;
|
||||
} catch (error) {
|
||||
// If detection fails, assume it's a real device to be safe
|
||||
console.warn('Emulator detection failed:', error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -73,7 +72,6 @@ const LocationTestWrapper: React.FC<LocationTestWrapperProps> = ({ children }) =
|
|||
const { status } = await Location.requestForegroundPermissionsAsync();
|
||||
if (status === 'granted') {
|
||||
const location = await Location.getCurrentPositionAsync({});
|
||||
console.log('User location:', location.coords);
|
||||
setUserLocation(location);
|
||||
} else {
|
||||
setLocationDialogOpen(true);
|
||||
|
|
|
|||
|
|
@ -100,8 +100,6 @@ export default function NextOrderGlimpse() {
|
|||
<TouchableOpacity
|
||||
style={tw`px-6 mb-4`}
|
||||
onPress={() => {
|
||||
console.log('from next press')
|
||||
|
||||
setNavigationTarget(`/(drawer)/(tabs)/me/my-orders/${nextOrder.id}`);
|
||||
router.replace('/(drawer)/(tabs)/me');
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -160,8 +160,6 @@ const PaymentAndOrderComponent: React.FC<PaymentAndOrderProps> = ({
|
|||
isFlashDelivery: isFlashDelivery,
|
||||
};
|
||||
|
||||
console.log({orderData})
|
||||
|
||||
placeOrderMutation.mutate(orderData);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
|
|||
setHasMore(newHasMore);
|
||||
setReviewsOffset(reset ? 10 : reviewsOffset + 10);
|
||||
} catch (error) {
|
||||
console.error('Error loading reviews:', error);
|
||||
// Error loading reviews handled silently
|
||||
} finally {
|
||||
setReviewsLoading(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,7 +354,6 @@ export function SlotProducts({ slotId:slotIdParent, storeId:storeIdParent, baseU
|
|||
|
||||
const handleAddToCart = (productId: number) => {
|
||||
setIsLoadingDialogOpen(true);
|
||||
// console.log({productId})
|
||||
|
||||
addToCart(productId, 1, slotId || 0, () => setIsLoadingDialogOpen(false));
|
||||
};
|
||||
|
|
@ -394,8 +393,6 @@ export function SlotProducts({ slotId:slotIdParent, storeId:storeIdParent, baseU
|
|||
|
||||
const filteredProducts: any[] = storeIdNum ? productsQuery?.data?.filter(p => p.store?.id === storeIdNum) || [] : slotQuery.data.products;
|
||||
|
||||
console.log({filteredProducts})
|
||||
|
||||
return (
|
||||
<View style={tw`flex-1`}>
|
||||
<MyFlatList
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const UpdateChecker: React.FC<UpdateCheckerProps> = ({ children }) => {
|
|||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Update check failed:', error);
|
||||
// Update check failed silently
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ const CheckoutPage: React.FC<CheckoutPageProps> = ({ isFlashDelivery = false })
|
|||
|
||||
const cartType: "regular" | "flash" = isFlashDelivery ? "flash" : "regular";
|
||||
const { data: cartData, refetch: refetchCart } = useGetCart({}, cartType);
|
||||
console.log({cartType})
|
||||
|
||||
|
||||
const { data: addresses, refetch: refetchAddresses } = trpc.user.address.getUserAddresses.useQuery();
|
||||
const { data: slotsData, refetch: refetchSlots } = trpc.user.slots.getSlots.useQuery();
|
||||
const { data: constsData } = useGetEssentialConsts();
|
||||
|
|
|
|||
|
|
@ -301,8 +301,6 @@ export function useAddToCart(options?: {
|
|||
|
||||
const addToCart = (productId: number, quantity = 1, slotId?: number, onSettled?: (data: any, error: any) => void) => {
|
||||
|
||||
// console.log({productId, quantity, slotId})
|
||||
|
||||
if (slotId == null) {
|
||||
throw new Error('slotId is required for adding to cart');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ export function useAuthenticatedRoute(options: AuthenticatedRouteOptions = {}) {
|
|||
router.push('/(auth)/login');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Failed to store redirect state:', error);
|
||||
// Still navigate to login even if storage fails
|
||||
router.push('/(auth)/login');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ const moveDirectories = async (userInput) => {
|
|||
if (userInput === "y") {
|
||||
// Create the app-example directory
|
||||
await fs.promises.mkdir(exampleDirPath, { recursive: true });
|
||||
console.log(`📁 /${exampleDir} directory created.`);
|
||||
}
|
||||
|
||||
// Move old directories to new app-example directory or delete them
|
||||
|
|
@ -60,41 +59,25 @@ const moveDirectories = async (userInput) => {
|
|||
if (userInput === "y") {
|
||||
const newDirPath = path.join(root, exampleDir, dir);
|
||||
await fs.promises.rename(oldDirPath, newDirPath);
|
||||
console.log(`➡️ /${dir} moved to /${exampleDir}/${dir}.`);
|
||||
} else {
|
||||
await fs.promises.rm(oldDirPath, { recursive: true, force: true });
|
||||
console.log(`❌ /${dir} deleted.`);
|
||||
}
|
||||
} else {
|
||||
console.log(`➡️ /${dir} does not exist, skipping.`);
|
||||
}
|
||||
}
|
||||
|
||||
// Create new /app directory
|
||||
const newAppDirPath = path.join(root, newAppDir);
|
||||
await fs.promises.mkdir(newAppDirPath, { recursive: true });
|
||||
console.log("\n📁 New /app directory created.");
|
||||
|
||||
// Create index.tsx
|
||||
const indexPath = path.join(newAppDirPath, "index.tsx");
|
||||
await fs.promises.writeFile(indexPath, indexContent);
|
||||
console.log("📄 app/index.tsx created.");
|
||||
|
||||
// Create _layout.tsx
|
||||
const layoutPath = path.join(newAppDirPath, "_layout.tsx");
|
||||
await fs.promises.writeFile(layoutPath, layoutContent);
|
||||
console.log("📄 app/_layout.tsx created.");
|
||||
|
||||
console.log("\n✅ Project reset complete. Next steps:");
|
||||
console.log(
|
||||
`1. Run \`npx expo start\` to start a development server.\n2. Edit app/index.tsx to edit the main screen.${
|
||||
userInput === "y"
|
||||
? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`
|
||||
: ""
|
||||
}`
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(`❌ Error during script execution: ${error.message}`);
|
||||
// Error during script execution
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -105,7 +88,6 @@ rl.question(
|
|||
if (userInput === "y" || userInput === "n") {
|
||||
moveDirectories(userInput).finally(() => rl.close());
|
||||
} else {
|
||||
console.log("❌ Invalid input. Please enter 'Y' or 'N'.");
|
||||
rl.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ export async function registerForPushNotificationsAsync() {
|
|||
projectId,
|
||||
})
|
||||
).data;
|
||||
console.log(pushTokenString);
|
||||
return pushTokenString;
|
||||
} catch (e: unknown) {
|
||||
throw new Error(`${e}`);
|
||||
|
|
|
|||
|
|
@ -59,6 +59,6 @@ export const useRegister = () => {
|
|||
export const useUpdateProfile = () => {
|
||||
return useMutation({
|
||||
mutationFn: updateProfileApi,
|
||||
onError: e => console.log(JSON.stringify(e))
|
||||
onError: () => {}
|
||||
});
|
||||
};
|
||||
|
|
@ -79,7 +79,6 @@ const AddressForm: React.FC<AddressFormProps> = ({ onSuccess, initialValues, isE
|
|||
setCurrentLocation({ latitude, longitude });
|
||||
Alert.alert('Success', 'Location attached successfully');
|
||||
} catch (error) {
|
||||
console.error('Location error:', error);
|
||||
setLocationError('Unable to fetch location. Please check your GPS settings.');
|
||||
} finally {
|
||||
setLocationLoading(false);
|
||||
|
|
|
|||
|
|
@ -29,15 +29,6 @@ export default function GoogleSignInPKCE() {
|
|||
// });
|
||||
|
||||
|
||||
|
||||
// React.useEffect(() => {
|
||||
// if (response?.type === "success") {
|
||||
// const { authentication } = response;
|
||||
// console.log("Access token:", authentication?.accessToken);
|
||||
// }
|
||||
// }, [response]);
|
||||
|
||||
|
||||
return (
|
||||
<View style={{ marginTop: 100 }}>
|
||||
<Button title="Sign in with Google" onPress={() => {}} />
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
|
|||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Auth initialization error:', error);
|
||||
setAuthState(prev => ({
|
||||
...prev,
|
||||
userDetails: null,
|
||||
|
|
@ -105,7 +104,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
|
|||
isLoading: false,
|
||||
}));
|
||||
} else if (selfDataError && authState.isAuthenticated) {
|
||||
console.error('Failed to fetch user data:', selfDataError);
|
||||
// If token is invalid, clear auth state
|
||||
// deleteAuthToken();
|
||||
setAuthState({
|
||||
|
|
@ -122,20 +120,16 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
|
|||
const handlePostLoginRedirect = async () => {
|
||||
try {
|
||||
const storedData = await StorageServiceCasual.getItem(constants.AUTH_REDIRECT_KEY);
|
||||
console.log({storedData})
|
||||
|
||||
if (storedData) {
|
||||
const redirectState: RedirectState = JSON.parse(storedData);
|
||||
console.log({redirectState})
|
||||
|
||||
|
||||
// Clear the stored state
|
||||
await StorageServiceCasual.removeItem(constants.AUTH_REDIRECT_KEY);
|
||||
|
||||
// Check if the redirect state is not too old (24 hours)
|
||||
const isExpired = Date.now() - redirectState.timestamp > 24 * 60 * 60 * 1000;
|
||||
if (isExpired) {
|
||||
console.warn('Redirect state expired, navigating to home');
|
||||
// router.replace('/');
|
||||
router.back();
|
||||
return;
|
||||
|
|
@ -164,7 +158,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
|
|||
router.back();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error handling post-login redirect:', error);
|
||||
// Fallback to home on error
|
||||
router.replace('/');
|
||||
}
|
||||
|
|
@ -195,7 +188,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
|
|||
// Handle post-login redirect after auth state is set
|
||||
handlePostLoginRedirect();
|
||||
} catch (error) {
|
||||
console.error('Login with token error:', error);
|
||||
setAuthState(prev => ({ ...prev, isLoading: false }));
|
||||
throw error;
|
||||
}
|
||||
|
|
@ -280,7 +272,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
|
|||
token: null,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Logout error:', error);
|
||||
// Still clear local state even if deleteJWT fails
|
||||
setAuthState({
|
||||
user: null,
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ const isDevMode = Constants.executionEnvironment !== "standalone";
|
|||
// const BASE_API_URL = API_URL;
|
||||
// const BASE_API_URL = 'http://10.0.2.2:4000';
|
||||
// const BASE_API_URL = 'http://192.168.100.101:4000';
|
||||
// const BASE_API_URL = 'http://192.168.1.14:4000';
|
||||
let BASE_API_URL = "https://mf.freshyo.in";
|
||||
const BASE_API_URL = 'http://192.168.1.7:4000';
|
||||
// let BASE_API_URL = "https://mf.freshyo.in";
|
||||
// let BASE_API_URL = 'http://192.168.100.103:4000';
|
||||
// let BASE_API_URL = 'http://192.168.29.176:4000';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue