feat: lint code

This commit is contained in:
Joel
2023-06-10 14:04:40 +08:00
parent 2e46f795a4
commit cfd0c9532f
36 changed files with 226 additions and 210 deletions

View File

@ -1,6 +1,6 @@
import { useState } from 'react'
import type { ConversationItem } from '@/types/app'
import produce from 'immer'
import type { ConversationItem } from '@/types/app'
const storageConversationIdKey = 'conversationIdInfo'
@ -29,9 +29,10 @@ function useConversation() {
// input can be updated by user
const [newConversationInputs, setNewConversationInputs] = useState<Record<string, any> | null>(null)
const resetNewConversationInputs = () => {
if (!newConversationInputs) return
setNewConversationInputs(produce(newConversationInputs, draft => {
Object.keys(draft).forEach(key => {
if (!newConversationInputs)
return
setNewConversationInputs(produce(newConversationInputs, (draft) => {
Object.keys(draft).forEach((key) => {
draft[key] = ''
})
}))
@ -59,8 +60,8 @@ function useConversation() {
setCurrInputs,
currConversationInfo,
setNewConversationInfo,
setExistConversationInfo
setExistConversationInfo,
}
}
export default useConversation;
export default useConversation