fix registration on production

This commit is contained in:
aurinex
2025-12-19 21:45:24 +05:00
parent fef89513c2
commit 3aa99e7262

View File

@ -29,6 +29,7 @@ import {
isNotificationsEnabled,
getNotifPositionFromSettings,
} from '../utils/notifications';
import { useNavigate } from 'react-router-dom';
const ColorlibConnector = styled(StepConnector)(({ theme }) => ({
[`&.${stepConnectorClasses.alternativeLabel}`]: {
@ -168,6 +169,8 @@ export const Registration = () => {
horizontal: 'center',
});
const navigate = useNavigate();
const showNotification = (
message: React.ReactNode,
severity: 'success' | 'info' | 'warning' | 'error' = 'info',
@ -197,15 +200,15 @@ export const Registration = () => {
showNotification('Заполните все поля', 'warning');
return;
}
if (password !== enterpassword) {
showNotification('Пароли не совпадают', 'warning');
return;
}
try {
const response = await registerUser(username, password);
if (response.status === 'success') {
setActiveStep(1);
showNotification('Аккаунт создан. Перейдите к верификации.', 'success');
@ -290,7 +293,7 @@ export const Registration = () => {
const handleVerifyCode = async () => {
const response = await getVerificationStatus(username);
if (response.is_verified) {
window.location.href = '/login';
navigate('/login', { replace: true });
}
};