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 { useLoginModal } from '@/shared/zustand/auth';
import { toast } from 'react-toastify';
import { useRouter } from '@/shared/config/i18n/navigation';
interface LoginData {
phone: string;
@@ -15,6 +16,7 @@ interface LoginData {
export function useLoginForm() {
const [phone, setPhone] = useState('');
const [error, setError] = useState('');
const route = useRouter();
const toggleLoginModal = useLoginModal((state) => state.toggleLoginModal);
const loginReqest = useMutation({
mutationKey: ['login'],
@@ -23,6 +25,7 @@ export function useLoginForm() {
console.log('Login successful:', data);
toggleLoginModal();
toast.success('Kirish muvaffaqiyatli!');
route.push('/plagat');
},
onError: (err) => {
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 { links } from '@/shared/request/links';
import { toast } from 'react-toastify';
import { useRouter } from '@/shared/config/i18n/navigation';
interface RegisterData {
name: string;
@@ -20,6 +21,7 @@ export function useRegisterForm() {
useRegisterZustand();
const [errors, setErrors] = useState<RegisterErrors>({});
const [success, setSuccess] = useState(false);
const route = useRouter();
const toggleRegisterModal = useRegisterModal(
(state) => state.toggleRegisterModal,
);
@@ -33,6 +35,7 @@ export function useRegisterForm() {
toggleRegisterModal();
setSuccess(true);
toast.success("Ro'yxatdan o'tish muvaffaqiyatli!");
route.push('/plagat');
},
onError: (err) => {
// toggleLoginModal();

View File

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

View File

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

View File

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

View File

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