websocket bug fiz

This commit is contained in:
Samandar Turgunboyev
2025-11-29 10:34:56 +05:00
parent 6cf0a4200b
commit 5c4e1327be
3 changed files with 8 additions and 3 deletions

View File

@@ -37,7 +37,11 @@ import z from "zod";
import { auth_api } from "../lib/api"; import { auth_api } from "../lib/api";
import { loginform } from "../lib/form"; import { loginform } from "../lib/form";
export default function LoginForm() { interface LoginFormProps {
onLogin: (body: { telegram_id: string }) => void;
}
export default function LoginForm({ onLogin }: LoginFormProps) {
const { user, setLoginUser } = userInfoStore(); const { user, setLoginUser } = userInfoStore();
const form = useForm<z.infer<typeof loginform>>({ const form = useForm<z.infer<typeof loginform>>({
@@ -66,6 +70,7 @@ export default function LoginForm() {
first_name: form.getValues("firstName"), first_name: form.getValues("firstName"),
last_name: form.getValues("lastName"), last_name: form.getValues("lastName"),
}); });
onLogin({ telegram_id: user.user_id });
}, },
onError: (error: AxiosError) => { onError: (error: AxiosError) => {
const data = error.response?.data as { message?: string }; const data = error.response?.data as { message?: string };

View File

@@ -110,7 +110,7 @@ const TokenLayout = ({ children }: { children: React.ReactNode }) => {
); );
} }
return <>{token || gettoken ? children : <LoginForm />}</>; return <>{token || gettoken ? children : <LoginForm onLogin={login} />}</>;
}; };
export default TokenLayout; export default TokenLayout;

View File

@@ -17,7 +17,7 @@ export default defineConfig({
port: 5174, port: 5174,
host: true, // barcha hostlarga ruxsat host: true, // barcha hostlarga ruxsat
allowedHosts: [ allowedHosts: [
"seating-hostel-amended-ooo.trycloudflare.com", // ngrok host qo'shildi "factory-epa-announced-adapter.trycloudflare.com", // ngrok host qo'shildi
], ],
}, },
}); });