From 3aa99e7262ea0ce4db065b5327e39cde4685af40 Mon Sep 17 00:00:00 2001 From: aurinex Date: Fri, 19 Dec 2025 21:45:24 +0500 Subject: [PATCH] fix registration on production --- src/renderer/pages/Registration.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/renderer/pages/Registration.tsx b/src/renderer/pages/Registration.tsx index f6c7ff3..79102d2 100644 --- a/src/renderer/pages/Registration.tsx +++ b/src/renderer/pages/Registration.tsx @@ -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 }); } };