feat: add redirect alerts for debugging stripe flow

This commit is contained in:
Marcio Bevervanso 2026-04-13 19:26:09 -03:00
parent 0ab94f88c9
commit 37e9f199f4

View file

@ -112,14 +112,19 @@ const AppContent: React.FC = () => {
body: JSON.stringify({ plan: "mensal" })
});
const { url, error } = await res.json();
if (!error && url) {
if (error) {
alert('Falha interna ao inicializar carrinho: ' + JSON.stringify(error));
} else if (url) {
localStorage.removeItem('intended_plan');
window.location.href = url; // Redireciona pro Checkout
return;
}
} else {
alert('Sessão não encontrada para redirecionamento. Verifique se precisa confirmar o email.');
}
} catch (e) {
console.error("Falha ao redirecionar para o checkout:", e);
alert('Erro ao comunicar com o servidor: ' + e);
}
}