* refactor: replacing mobx with jotai Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai> Co-authored-by: Louis <louis@jan.ai>
17 lines
440 B
TypeScript
17 lines
440 B
TypeScript
import {
|
|
SubscribeMessageSubscription,
|
|
SubscribeMessageDocument,
|
|
} from "@/graphql";
|
|
import { useSubscription } from "@apollo/client";
|
|
|
|
const useChatMessageSubscription = (messageId: string) => {
|
|
const { data, loading, error } =
|
|
useSubscription<SubscribeMessageSubscription>(SubscribeMessageDocument, {
|
|
variables: { id: messageId },
|
|
});
|
|
|
|
return { data, loading, error };
|
|
};
|
|
|
|
export default useChatMessageSubscription;
|