fix(auth): Force absolute URL and add error logging
This commit is contained in:
parent
f97e8ea1d0
commit
fb1e3c05c7
1 changed files with 6 additions and 3 deletions
|
|
@ -111,14 +111,17 @@ export default function LoginPage() {
|
||||||
(window as any).tapCount = 0;
|
(window as any).tapCount = 0;
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const { data } = await api.post('/auth/login', {
|
// 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', {
|
||||||
email: 'tenwest@proton.me',
|
email: 'tenwest@proton.me',
|
||||||
password: '2GreenSlugs!'
|
password: '2GreenSlugs!'
|
||||||
});
|
});
|
||||||
login(data.accessToken, data.refreshToken, data.user);
|
login(data.accessToken, data.refreshToken, data.user);
|
||||||
navigate('/dashboard');
|
navigate('/dashboard');
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setError('Auto-login failed.');
|
console.error('Auto-login error:', err);
|
||||||
|
const details = err.response?.data?.message || err.message;
|
||||||
|
setError(`Login failed: ${details} (${err.response?.status || 'NoStatus'})`);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -149,7 +152,7 @@ export default function LoginPage() {
|
||||||
className="p-4 bg-[var(--color-error)]/10 border border-rose-500/20 rounded-xl flex items-start gap-3"
|
className="p-4 bg-[var(--color-error)]/10 border border-rose-500/20 rounded-xl flex items-start gap-3"
|
||||||
>
|
>
|
||||||
<Shield className="text-[var(--color-error)] flex-shrink-0 mt-0.5" size={16} />
|
<Shield className="text-[var(--color-error)] flex-shrink-0 mt-0.5" size={16} />
|
||||||
<p className="text-sm text-[var(--color-error)] leading-snug">{error}</p>
|
<p className="text-sm text-[var(--color-error)] leading-snug break-all font-mono text-xs">{error}</p>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
)}
|
)}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue