Temp poling messages
This commit is contained in:
parent
94f14d101d
commit
06cb620211
|
@ -55,7 +55,7 @@ const Message = (props: Props) => {
|
|||
<div innerHTML={md.render(props.content.body)} />
|
||||
</div>
|
||||
</div>
|
||||
<div class={styles.time}>{formattedTime(props.content.createdAt)}</div>
|
||||
<div class={styles.time}>{formattedTime(props.content.createdAt * 1000)}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import MessagesFallback from '../Inbox/MessagesFallback'
|
|||
import QuotedMessage from '../Inbox/QuotedMessage'
|
||||
import { Icon } from '../_shared/Icon'
|
||||
import { useSession } from '../../context/session'
|
||||
import { loadRecipients } from '../../stores/inbox'
|
||||
import { loadMessages, loadRecipients } from '../../stores/inbox'
|
||||
import { t } from '../../utils/intl'
|
||||
import { Modal } from '../Nav/Modal'
|
||||
import { showModal } from '../../stores/ui'
|
||||
|
@ -68,6 +68,20 @@ export const InboxView = () => {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: удалить когда будет готова подписка
|
||||
createEffect(() => {
|
||||
setInterval(async () => {
|
||||
if (!currentDialog()) return
|
||||
try {
|
||||
await getMessages(currentDialog().id)
|
||||
} catch (error) {
|
||||
console.error('[getMessages]', error)
|
||||
} finally {
|
||||
chatWindow.scrollTop = chatWindow.scrollHeight
|
||||
}
|
||||
}, 2000)
|
||||
})
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
const response = await loadRecipients({ days: 365 })
|
||||
|
|
Loading…
Reference in New Issue
Block a user