fix:(cadastro) ajusta redirecionamento ao cadatrar um cliente
This commit is contained in:
parent
29662a1081
commit
4ce07c1fc5
3 changed files with 67 additions and 54 deletions
|
|
@ -13,6 +13,7 @@ import { Dashboard } from "./pages/Dashboard";
|
||||||
import { Login } from "./pages/Login";
|
import { Login } from "./pages/Login";
|
||||||
import { Register } from "./pages/Register";
|
import { Register } from "./pages/Register";
|
||||||
import { ProfessionalRegister } from "./pages/ProfessionalRegister";
|
import { ProfessionalRegister } from "./pages/ProfessionalRegister";
|
||||||
|
import { RegistrationSuccess } from "./pages/RegistrationSuccess";
|
||||||
import { TeamPage } from "./pages/Team";
|
import { TeamPage } from "./pages/Team";
|
||||||
import EventDetails from "./pages/EventDetails";
|
import EventDetails from "./pages/EventDetails";
|
||||||
import Finance from "./pages/Finance";
|
import Finance from "./pages/Finance";
|
||||||
|
|
@ -573,6 +574,7 @@ const AppContent: React.FC = () => {
|
||||||
<ProfessionalRegisterWithRouter />
|
<ProfessionalRegisterWithRouter />
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<Route path="/cadastro-sucesso" element={<RegistrationSuccess />} />
|
||||||
<Route
|
<Route
|
||||||
path="/privacidade"
|
path="/privacidade"
|
||||||
element={
|
element={
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ export const Register: React.FC<RegisterProps> = ({ onNavigate }) => {
|
||||||
const [agreedToTerms, setAgreedToTerms] = useState(false);
|
const [agreedToTerms, setAgreedToTerms] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
const [isPending, setIsPending] = useState(false);
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadCompanies = async () => {
|
const loadCompanies = async () => {
|
||||||
|
|
@ -108,65 +109,14 @@ export const Register: React.FC<RegisterProps> = ({ onNavigate }) => {
|
||||||
cidade: formData.cidade,
|
cidade: formData.cidade,
|
||||||
estado: formData.estado,
|
estado: formData.estado,
|
||||||
});
|
});
|
||||||
// Limpar dados de sessão após cadastro bem-sucedido
|
|
||||||
sessionStorage.removeItem('accessCodeValidated');
|
|
||||||
sessionStorage.removeItem('accessCodeData');
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
setIsPending(true);
|
window.location.href = "/cadastro-sucesso";
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
setError(err.message || "Erro ao realizar cadastro");
|
setError(err.message || "Erro ao realizar cadastro");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (isPending) {
|
|
||||||
return (
|
|
||||||
<div className="min-h-screen flex items-center justify-center bg-white">
|
|
||||||
<div className="text-center fade-in max-w-md px-4">
|
|
||||||
<div className="w-16 h-16 bg-yellow-500 rounded-full flex items-center justify-center mx-auto mb-4">
|
|
||||||
<svg
|
|
||||||
className="w-8 h-8 text-white"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
strokeWidth={2}
|
|
||||||
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<h2 className="text-2xl font-bold text-gray-900 mb-2">
|
|
||||||
Cadastro Pendente de Aprovação
|
|
||||||
</h2>
|
|
||||||
<p className="text-gray-600 mb-4">
|
|
||||||
Seu cadastro foi realizado com sucesso e está aguardando aprovação
|
|
||||||
da empresa.
|
|
||||||
</p>
|
|
||||||
<p className="text-gray-600 mb-6">
|
|
||||||
Você receberá um e-mail assim que seu cadastro for aprovado e poderá
|
|
||||||
acessar o sistema.
|
|
||||||
</p>
|
|
||||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4 mb-6">
|
|
||||||
<p className="text-sm text-yellow-800">
|
|
||||||
<strong>Atenção:</strong> Enquanto seu cadastro não for aprovado,
|
|
||||||
você não terá acesso ao sistema.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
onClick={() => {
|
|
||||||
window.location.href = "/";
|
|
||||||
}}
|
|
||||||
className="w-full px-6 py-2 text-white font-semibold rounded-lg hover:bg-opacity-90 transition-colors"
|
|
||||||
style={{ backgroundColor: "#B9CF33" }}
|
|
||||||
>
|
|
||||||
OK
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-gray-50 to-white p-4 py-8 pt-24">
|
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-gray-50 to-white p-4 py-8 pt-24">
|
||||||
|
|
|
||||||
61
frontend/pages/RegistrationSuccess.tsx
Normal file
61
frontend/pages/RegistrationSuccess.tsx
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
export const RegistrationSuccess: React.FC = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
// Clear session data to lock /cadastro again
|
||||||
|
sessionStorage.removeItem('accessCodeValidated');
|
||||||
|
sessionStorage.removeItem('accessCodeData');
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen flex items-center justify-center bg-white">
|
||||||
|
<div className="text-center fade-in max-w-md px-4">
|
||||||
|
<div className="w-16 h-16 bg-yellow-500 rounded-full flex items-center justify-center mx-auto mb-4">
|
||||||
|
<svg
|
||||||
|
className="w-8 h-8 text-white"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
strokeWidth={2}
|
||||||
|
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<h2 className="text-2xl font-bold text-gray-900 mb-2">
|
||||||
|
Cadastro Pendente de Aprovação
|
||||||
|
</h2>
|
||||||
|
<p className="text-gray-600 mb-4">
|
||||||
|
Seu cadastro foi realizado com sucesso e está aguardando aprovação
|
||||||
|
da empresa.
|
||||||
|
</p>
|
||||||
|
<p className="text-gray-600 mb-6">
|
||||||
|
Você receberá um e-mail assim que seu cadastro for aprovado e poderá
|
||||||
|
acessar o sistema.
|
||||||
|
</p>
|
||||||
|
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4 mb-6">
|
||||||
|
<p className="text-sm text-yellow-800">
|
||||||
|
<strong>Atenção:</strong> Enquanto seu cadastro não for aprovado,
|
||||||
|
você não terá acesso ao sistema.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
window.location.href = "/";
|
||||||
|
}}
|
||||||
|
className="w-full px-6 py-2 text-white font-semibold rounded-lg hover:bg-opacity-90 transition-colors"
|
||||||
|
style={{ backgroundColor: "#B9CF33" }}
|
||||||
|
>
|
||||||
|
OK
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue