18 lines
449 B
TypeScript
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>;
|
|
};
|