chore: remove user store

This commit is contained in:
Steven
2023-03-19 23:40:06 +08:00
parent d11648f2bb
commit d2427f4e5f
6 changed files with 19 additions and 36 deletions

View File

@ -1,7 +1,7 @@
import { useEffect, useRef, useState } from "react";
import { toast } from "react-hot-toast";
import TextareaAutosize from "react-textarea-autosize";
import { useChatStore, useMessageStore, useUserStore } from "../../store";
import { localUser, useChatStore, useMessageStore } from "../../store";
import { generateUUID } from "../../utils";
import Icon from "../Icon";
@ -12,7 +12,6 @@ interface Props {
const MessageTextarea = (props: Props) => {
const { disabled, sendMessage } = props;
const userStore = useUserStore();
const chatStore = useChatStore();
const messageStore = useMessageStore();
const [value, setValue] = useState<string>("");
@ -45,7 +44,7 @@ const MessageTextarea = (props: Props) => {
messageStore.addMessage({
id: generateUUID(),
chatId: chatStore.currentChat.id,
creatorId: userStore.currentUser.id,
creatorId: localUser.id,
createdAt: Date.now(),
content: value,
});