websocket bug fiz
This commit is contained in:
@@ -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 };
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user