Files
var-monorepo/apps/dispatch/app/(dispatch)/_components/Connection.tsx
2025-03-14 19:46:09 -07:00

18 lines
449 B
TypeScript

import { useSession } from "next-auth/react";
import { connectionStore } from "../../_store/connectionStore";
import { useEffect } from "react";
export const Connection = () => {
const session = useSession();
const cStore = connectionStore((state) => state);
const uid = session.data?.user?.id;
useEffect(() => {
if (uid) {
cStore.connect(uid);
}
}, [uid]);
return <div>{cStore.isConnected ? "Connected" : "Not Connected"}</div>;
};