refactor: more TS code

This commit is contained in:
Tristan Yang
2022-07-08 22:30:06 +08:00
parent 9f1b115c73
commit c7eae47fb2
11 changed files with 33 additions and 80 deletions
+7 -7
View File
@@ -19,14 +19,13 @@ interface SendMessagesDTO {
}
interface SendMessageDTO {
type: "text";
content: string;
properties: object;
reply_mid?: number;
context: "user" | "channel";
from: number;
to: number;
}
export default function useSendMessage(props?: Props) {
const { context = "user", from = null, to = null } = props || {};
const useSendMessage = (props: Props) => {
const { context = "user", from, to = null } = props;
const dispatch = useAppDispatch();
const stageFiles = useAppSelector((store) => store.ui.uploadFiles[`${context}_${to}`] || []);
const [replyMessage, { isError: replyErr, isLoading: replying, isSuccess: replySuccess }] =
@@ -110,4 +109,5 @@ export default function useSendMessage(props?: Props) {
isSending: userSending || channelSending || replying,
isSuccess: channelSuccess || userSuccess || replySuccess
};
}
};
export default useSendMessage;