login register updated
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
"phonePlaceholder": "90 123 45 67",
|
||||
"digitsEntered": "Введено {count} цифр",
|
||||
"sending": "Отправка…",
|
||||
"sendCode": "Отправить код",
|
||||
"sendCode": "Вход",
|
||||
"registerPrompt": "Нет аккаунта?",
|
||||
"registerLink": "Зарегистрироваться"
|
||||
},
|
||||
|
||||
@@ -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";
|
||||
};
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user