migrate to blitzjs
This commit is contained in:
19
app/messages/hooks/use-conversation.ts
Normal file
19
app/messages/hooks/use-conversation.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { useQuery } from "blitz"
|
||||
|
||||
import getConversationsQuery from "../queries/get-conversations"
|
||||
|
||||
export default function useConversation(recipient: string) {
|
||||
return useQuery(
|
||||
getConversationsQuery,
|
||||
{},
|
||||
{
|
||||
select(conversations) {
|
||||
if (!conversations[recipient]) {
|
||||
throw new Error("Conversation not found")
|
||||
}
|
||||
|
||||
return conversations[recipient]!
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user