fix(android): Use native fetch for login + add Veridian app icon
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 397 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 397 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 397 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 397 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 397 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 397 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 397 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 397 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 397 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 397 KiB |
|
|
@ -111,17 +111,30 @@ export default function LoginPage() {
|
|||
(window as any).tapCount = 0;
|
||||
setIsLoading(true);
|
||||
try {
|
||||
// Force absolute URL to bypass potentially broken API client config in native context
|
||||
const { data } = await api.post('https://veridian.runfoo.run/api/auth/login', {
|
||||
// Use native fetch instead of axios for better Capacitor WebView compatibility
|
||||
const response = await fetch('https://veridian.runfoo.run/api/auth/login', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email: 'tenwest@proton.me',
|
||||
password: '2GreenSlugs!'
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json().catch(() => ({}));
|
||||
throw new Error(errorData.message || `HTTP ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
login(data.accessToken, data.refreshToken, data.user);
|
||||
navigate('/dashboard');
|
||||
} catch (err: any) {
|
||||
console.error('Auto-login error:', err);
|
||||
const details = err.response?.data?.message || err.message;
|
||||
setError(`Login failed: ${details} (${err.response?.status || 'NoStatus'})`);
|
||||
setError(`Login failed: ${err.message}`);
|
||||
setIsLoading(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||