test sse endpoint

This commit is contained in:
tonyrewin 2022-12-12 11:56:54 +03:00
parent 2ed61fd763
commit 582b666da2
6 changed files with 12040 additions and 4 deletions

12034
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -87,6 +87,7 @@ export const InboxView = () => {
setPostMessageText('') setPostMessageText('')
setMessageToReply(null) setMessageToReply(null)
chatWindow.scrollTop = chatWindow.scrollHeight chatWindow.scrollTop = chatWindow.scrollHeight
console.log('!!! messages:', messages())
} catch (error) { } catch (error) {
console.error('[post message error]:', error) console.error('[post message error]:', error)
} }
@ -104,7 +105,6 @@ export const InboxView = () => {
if (textareaParent) { if (textareaParent) {
textareaParent.dataset.replicatedValue = postMessageText() textareaParent.dataset.replicatedValue = postMessageText()
} }
console.log('!!! messages:', messages())
if (params['initChat']) { if (params['initChat']) {
try { try {
const newChat = await actions.createChat([Number(params['initChat'])], '') const newChat = await actions.createChat([Number(params['initChat'])], '')

View File

@ -49,7 +49,8 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
const { unsubscribe } = pipe( const { unsubscribe } = pipe(
subclient().subscription(newMessage, {}), subclient().subscription(newMessage, {}),
subscribe((result) => { subscribe((result) => {
console.debug('[subscription] ' + result) console.info('[subscription]')
console.debug(result)
// TODO: handle data result // TODO: handle data result
}) })
) )

View File

@ -37,7 +37,7 @@ export const resetToken = () => {
} }
const options: ClientOptions = { const options: ClientOptions = {
url: apiBaseUrl, url: apiBaseUrl + '/graphql',
maskTypename: true, maskTypename: true,
requestPolicy: 'cache-and-network', requestPolicy: 'cache-and-network',
fetchOptions: () => { fetchOptions: () => {

View File

@ -10,7 +10,7 @@ if (isDev) {
} }
const options: ClientOptions = { const options: ClientOptions = {
url: apiBaseUrl, url: apiBaseUrl + '/graphql',
maskTypename: true, maskTypename: true,
requestPolicy: 'cache-and-network', requestPolicy: 'cache-and-network',
exchanges exchanges

View File

@ -7,6 +7,7 @@ export default gql`
messages { messages {
author author
body body
replyTo
createdAt createdAt
id id
updatedAt updatedAt