i forgot whatever i've been doing, i think i added an inbox
This commit is contained in:
1 parent
ef037349f0
commit
04704749b7
24 files changed
+307
-86
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { authData, getClient } from '$lib/lemmy.js'
|
||||
import { getInboxItemPublished } from '$lib/lemmy/inbox.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export async function load() {
|
||||
const auth = get(authData)
|
||||
if (!auth) return
|
||||
|
||||
const client = getClient()
|
||||
|
||||
const params = {
|
||||
limit: 50,
|
||||
page: 1,
|
||||
auth: auth.token,
|
||||
}
|
||||
|
||||
const [replies, mentions, privateMessages] = await Promise.all([
|
||||
client.getReplies({
|
||||
...params,
|
||||
sort: 'New',
|
||||
}),
|
||||
client.getPersonMentions({
|
||||
...params,
|
||||
sort: 'New',
|
||||
}),
|
||||
client.getPrivateMessages(params),
|
||||
])
|
||||
|
||||
const data = [...replies.replies, ...mentions.mentions].sort(
|
||||
(a, b) =>
|
||||
Date.parse(getInboxItemPublished(b)) -
|
||||
Date.parse(getInboxItemPublished(a))
|
||||
)
|
||||
|
||||
return { data: data }
|
||||
}
|
||||
Reference in new issue
Block a user