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;
|
(window as any).tapCount = 0;
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
// Force absolute URL to bypass potentially broken API client config in native context
|
// Use native fetch instead of axios for better Capacitor WebView compatibility
|
||||||
const { data } = await api.post('https://veridian.runfoo.run/api/auth/login', {
|
const response = await fetch('https://veridian.runfoo.run/api/auth/login', {
|
||||||
email: 'tenwest@proton.me',
|
method: 'POST',
|
||||||
password: '2GreenSlugs!'
|
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);
|
login(data.accessToken, data.refreshToken, data.user);
|
||||||
navigate('/dashboard');
|
navigate('/dashboard');
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error('Auto-login error:', err);
|
console.error('Auto-login error:', err);
|
||||||
const details = err.response?.data?.message || err.message;
|
setError(`Login failed: ${err.message}`);
|
||||||
setError(`Login failed: ${details} (${err.response?.status || 'NoStatus'})`);
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||