inbox-client-fix
This commit is contained in:
parent
6334afb6fa
commit
866bea77de
|
@ -42,7 +42,7 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
|
||||||
}
|
}
|
||||||
const loadChats = async () => {
|
const loadChats = async () => {
|
||||||
try {
|
try {
|
||||||
const newChats = await apiClient.getChats({ limit: 50, offset: 0 })
|
const newChats = await inboxClient.getChats({ limit: 50, offset: 0 })
|
||||||
setChats(newChats)
|
setChats(newChats)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
@ -61,7 +61,7 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
|
||||||
|
|
||||||
const sendMessage = async (args) => {
|
const sendMessage = async (args) => {
|
||||||
try {
|
try {
|
||||||
const message = await apiClient.createMessage(args)
|
const message = await inboxClient.createMessage(args)
|
||||||
setMessages((prev) => [...prev, message])
|
setMessages((prev) => [...prev, message])
|
||||||
const currentChat = chats().find((chat) => chat.id === args.chat)
|
const currentChat = chats().find((chat) => chat.id === args.chat)
|
||||||
setChats((prev) => [
|
setChats((prev) => [
|
||||||
|
@ -74,7 +74,7 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const createChat = async (members: number[], title: string) => {
|
const createChat = async (members: number[], title: string) => {
|
||||||
const chat = await apiClient.createChat({ members, title })
|
const chat = await inboxClient.createChat({ members, title })
|
||||||
setChats((prevChats) => {
|
setChats((prevChats) => {
|
||||||
return [chat, ...prevChats]
|
return [chat, ...prevChats]
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user