fix-wonka
This commit is contained in:
parent
4f47a7334d
commit
b061ed59da
|
@ -51,8 +51,6 @@ export const InboxView = () => {
|
||||||
|
|
||||||
let chatWindow
|
let chatWindow
|
||||||
|
|
||||||
const onMessage = (payload) => console.log('!!! payload', payload)
|
|
||||||
// const listener = setListener
|
|
||||||
const handleOpenChat = async (chat: Chat) => {
|
const handleOpenChat = async (chat: Chat) => {
|
||||||
setCurrentDialog(chat)
|
setCurrentDialog(chat)
|
||||||
try {
|
try {
|
||||||
|
@ -70,7 +68,6 @@ export const InboxView = () => {
|
||||||
try {
|
try {
|
||||||
const response = await loadRecipients({ days: 365 })
|
const response = await loadRecipients({ days: 365 })
|
||||||
setRecipients(response as unknown as Author[])
|
setRecipients(response as unknown as Author[])
|
||||||
setListener(onMessage)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ export function useInbox() {
|
||||||
export const InboxProvider = (props: { children: JSX.Element }) => {
|
export const InboxProvider = (props: { children: JSX.Element }) => {
|
||||||
const [chats, setChats] = createSignal<Chat[]>([])
|
const [chats, setChats] = createSignal<Chat[]>([])
|
||||||
const [listener, setListener] = createSignal(console.debug)
|
const [listener, setListener] = createSignal(console.debug)
|
||||||
const subclient = createMemo<Client>(() => createChatClient(listener()))
|
const subclient = createMemo<Client>(() => createChatClient())
|
||||||
const loadChats = async () => {
|
const loadChats = async () => {
|
||||||
try {
|
try {
|
||||||
const newChats = await apiClient.getChats({ limit: 50, offset: 0 })
|
const newChats = await apiClient.getChats({ limit: 50, offset: 0 })
|
||||||
|
|
|
@ -49,10 +49,9 @@ const options: ClientOptions = {
|
||||||
|
|
||||||
export const privateGraphQLClient = createClient(options)
|
export const privateGraphQLClient = createClient(options)
|
||||||
|
|
||||||
export const createChatClient = (onMessage) => {
|
export const createChatClient = () => {
|
||||||
const sseClient = createSSEClient({
|
const sseClient = createSSEClient({
|
||||||
url: apiBaseUrl + '/messages',
|
url: apiBaseUrl + '/messages'
|
||||||
onMessage
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const sseExchange = subscriptionExchange({
|
const sseExchange = subscriptionExchange({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user