export default function Home() {
const [conversationName, setConversationName] = useState(''); // Updates the component
const addConversation = useMutation(api.conversations.createConversation);
const handleStart = async () => {
const conversationExists = await useQuery(api.conversations.exists, { name: conversationName as string });
if (!conversationExists) {
await addConversation({ name: conversationName as string, owner: "owner", participants: ["Danny"] });
}
router.push({ pathname: `/${conversationName}` });
};
return ...
export default function Home() {
const [conversationName, setConversationName] = useState(''); // Updates the component
const addConversation = useMutation(api.conversations.createConversation);
const handleStart = async () => {
const conversationExists = await useQuery(api.conversations.exists, { name: conversationName as string });
if (!conversationExists) {
await addConversation({ name: conversationName as string, owner: "owner", participants: ["Danny"] });
}
router.push({ pathname: `/${conversationName}` });
};
return ...