feat: add redirect alerts for debugging stripe flow
This commit is contained in:
parent
0ab94f88c9
commit
37e9f199f4
1 changed files with 6 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue