login register updated

This commit is contained in:
nabijonovdavronbek619@gmail.com
2026-04-01 12:47:31 +05:00
parent dd604ff235
commit cc13a0e1f9
6 changed files with 10 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ import { apiRequest } from '@/shared/request/apiRequest';
import { links } from '@/shared/request/links'; import { links } from '@/shared/request/links';
import { useLoginModal } from '@/shared/zustand/auth'; import { useLoginModal } from '@/shared/zustand/auth';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import { useRouter } from '@/shared/config/i18n/navigation';
interface LoginData { interface LoginData {
phone: string; phone: string;
@@ -15,6 +16,7 @@ interface LoginData {
export function useLoginForm() { export function useLoginForm() {
const [phone, setPhone] = useState(''); const [phone, setPhone] = useState('');
const [error, setError] = useState(''); const [error, setError] = useState('');
const route = useRouter();
const toggleLoginModal = useLoginModal((state) => state.toggleLoginModal); const toggleLoginModal = useLoginModal((state) => state.toggleLoginModal);
const loginReqest = useMutation({ const loginReqest = useMutation({
mutationKey: ['login'], mutationKey: ['login'],
@@ -23,6 +25,7 @@ export function useLoginForm() {
console.log('Login successful:', data); console.log('Login successful:', data);
toggleLoginModal(); toggleLoginModal();
toast.success('Kirish muvaffaqiyatli!'); toast.success('Kirish muvaffaqiyatli!');
route.push('/plagat');
}, },
onError: (err) => { onError: (err) => {
setError(err instanceof Error ? err.message : 'Unknown error'); setError(err instanceof Error ? err.message : 'Unknown error');

View File

@@ -8,6 +8,7 @@ import { useMutation } from '@tanstack/react-query';
import { apiRequest } from '@/shared/request/apiRequest'; import { apiRequest } from '@/shared/request/apiRequest';
import { links } from '@/shared/request/links'; import { links } from '@/shared/request/links';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import { useRouter } from '@/shared/config/i18n/navigation';
interface RegisterData { interface RegisterData {
name: string; name: string;
@@ -20,6 +21,7 @@ export function useRegisterForm() {
useRegisterZustand(); useRegisterZustand();
const [errors, setErrors] = useState<RegisterErrors>({}); const [errors, setErrors] = useState<RegisterErrors>({});
const [success, setSuccess] = useState(false); const [success, setSuccess] = useState(false);
const route = useRouter();
const toggleRegisterModal = useRegisterModal( const toggleRegisterModal = useRegisterModal(
(state) => state.toggleRegisterModal, (state) => state.toggleRegisterModal,
); );
@@ -33,6 +35,7 @@ export function useRegisterForm() {
toggleRegisterModal(); toggleRegisterModal();
setSuccess(true); setSuccess(true);
toast.success("Ro'yxatdan o'tish muvaffaqiyatli!"); toast.success("Ro'yxatdan o'tish muvaffaqiyatli!");
route.push('/plagat');
}, },
onError: (err) => { onError: (err) => {
// toggleLoginModal(); // toggleLoginModal();

View File

@@ -172,7 +172,7 @@
"phonePlaceholder": "90 123 45 67", "phonePlaceholder": "90 123 45 67",
"digitsEntered": "{count} digits entered", "digitsEntered": "{count} digits entered",
"sending": "Sending…", "sending": "Sending…",
"sendCode": "Send code", "sendCode": "Login",
"registerPrompt": "Don't have an account?", "registerPrompt": "Don't have an account?",
"registerLink": "Register" "registerLink": "Register"
}, },

View File

@@ -172,7 +172,7 @@
"phonePlaceholder": "90 123 45 67", "phonePlaceholder": "90 123 45 67",
"digitsEntered": "Введено {count} цифр", "digitsEntered": "Введено {count} цифр",
"sending": "Отправка…", "sending": "Отправка…",
"sendCode": "Отправить код", "sendCode": "Вход",
"registerPrompt": "Нет аккаунта?", "registerPrompt": "Нет аккаунта?",
"registerLink": "Зарегистрироваться" "registerLink": "Зарегистрироваться"
}, },

View File

@@ -175,7 +175,7 @@ declare const messages: {
phonePlaceholder: '90 123 45 67'; phonePlaceholder: '90 123 45 67';
digitsEntered: '{count} ta raqam kiritildi'; digitsEntered: '{count} ta raqam kiritildi';
sending: 'Yuborilmoqda…'; sending: 'Yuborilmoqda…';
sendCode: 'Kodni yuborish'; sendCode: 'Kirish';
registerPrompt: "Hisobingiz yo'qmi?"; registerPrompt: "Hisobingiz yo'qmi?";
registerLink: "Ro'yxatdan o'tish"; registerLink: "Ro'yxatdan o'tish";
}; };

View File

@@ -172,7 +172,7 @@
"phonePlaceholder": "90 123 45 67", "phonePlaceholder": "90 123 45 67",
"digitsEntered": "{count} ta raqam kiritildi", "digitsEntered": "{count} ta raqam kiritildi",
"sending": "Yuborilmoqda…", "sending": "Yuborilmoqda…",
"sendCode": "Kodni yuborish", "sendCode": "Kirish",
"registerPrompt": "Hisobingiz yo'qmi?", "registerPrompt": "Hisobingiz yo'qmi?",
"registerLink": "Ro'yxatdan o'tish" "registerLink": "Ro'yxatdan o'tish"
}, },