fixed comments

This commit is contained in:
c-d-p
2025-04-26 12:43:19 +02:00
parent 10e5a3c489
commit 22a4fc50a5
49 changed files with 165 additions and 148 deletions

View File

@@ -1,15 +1,13 @@
// src/api/client.ts
import axios, { AxiosError } from 'axios'; // Import AxiosError
import axios, { AxiosError } from 'axios';
import { Platform } from 'react-native';
import * as SecureStore from 'expo-secure-store';
import AsyncStorage from '@react-native-async-storage/async-storage';
// const API_BASE_URL = process.env.EXPO_PUBLIC_API_URL || 'http://192.168.255.221:8000/api'; // Use your machine's IP
// const API_BASE_URL = process.env.EXPO_PUBLIC_API_URL || 'http://192.168.1.9:8000/api'; // Use your machine's IP
const API_BASE_URL = process.env.EXPO_PUBLIC_API_URL || 'https://maia.depaoli.id.au/api'; // Use your machine's IP
const ACCESS_TOKEN_KEY = 'maia_access_token'; // Renamed for clarity
const REFRESH_TOKEN_KEY = 'maia_refresh_token'; // Key for refresh token
const API_BASE_URL = process.env.EXPO_PUBLIC_API_URL || 'https://maia.depaoli.id.au/api';
const ACCESS_TOKEN_KEY = 'maia_access_token';
const REFRESH_TOKEN_KEY = 'maia_refresh_token';
console.log("Using API Base URL:", API_BASE_URL);
@@ -34,7 +32,7 @@ const deleteToken = async (key: string): Promise<void> => {
if (Platform.OS === 'web') {
await AsyncStorage.removeItem(key);
} else {
await SecureStore.deleteItemAsync(key).catch(() => {}); // Ignore delete error
await SecureStore.deleteItemAsync(key).catch(() => {});
}
};

View File

@@ -13,7 +13,7 @@ const AuthNavigator = () => {
return (
<Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen name="Login" component={LoginScreen} />
<Stack.Screen name="Register" component={RegisterScreen} /> {/* Add Register screen */}
<Stack.Screen name="Register" component={RegisterScreen} />
</Stack.Navigator>
);
};

View File

@@ -35,11 +35,7 @@ const RegisterScreen: React.FC<RegisterScreenProps> = ({ navigation }) => {
await register(username, password, name);
console.log("[RegisterScreen] handleRegister: Registration successful (from context perspective).");
// Show success message and navigate back to Login
Alert.alert(
'Registration Successful',
'Your account has been created. Please log in.',
[{ text: 'OK', onPress: () => navigation.navigate('Login') }]
);
navigation.navigate('Login');
} catch (err: any) {
console.log("[RegisterScreen] handleRegister: Caught error from context register.");
const errorMessage = err.response?.data?.detail ||