Merge remote-tracking branch 'origin/prepare-inbox' into prepare-inbox
# Conflicts: # src/stores/inbox.ts
This commit is contained in:
commit
9af56f3425
|
@ -8,7 +8,7 @@ import Search from '../Inbox/Search'
|
|||
import { useSession } from '../../context/session'
|
||||
import { createClient } from '@urql/core'
|
||||
import Message from '../Inbox/Message'
|
||||
import { loadAuthorsBy, loadChats } from '../../stores/inbox'
|
||||
import { loadRecipients, loadChats } from '../../stores/inbox'
|
||||
import { t } from '../../utils/intl'
|
||||
import '../../styles/Inbox.scss'
|
||||
|
||||
|
@ -108,7 +108,7 @@ export const InboxView = () => {
|
|||
}
|
||||
|
||||
try {
|
||||
const response = await loadAuthorsBy({ days: 365 })
|
||||
const response = await loadRecipients({ days: 365 })
|
||||
setAuthors(response as unknown as Author[])
|
||||
setCashedAuthors(response as unknown as Author[])
|
||||
} catch (error) {
|
||||
|
|
14
src/graphql/query/chat-recipients.ts
Normal file
14
src/graphql/query/chat-recipients.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query GetChatsQuery($limit: Int, $offset: Int) {
|
||||
loadRecipients(limit: $limit, offset: $offset) {
|
||||
members {
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
error
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,8 +1,7 @@
|
|||
import { apiClient } from '../utils/apiClient'
|
||||
import type { AuthorsBy } from '../graphql/types.gen'
|
||||
|
||||
export const loadAuthorsBy = async (by: AuthorsBy): Promise<void> => {
|
||||
return await apiClient.getAuthorsBy({ by })
|
||||
export const loadRecipients = async (by = {}): Promise<void> => {
|
||||
return await apiClient.getRecipients(by)
|
||||
}
|
||||
|
||||
export const loadChats = async (): Promise<void> => {
|
||||
|
|
|
@ -39,6 +39,7 @@ import { REACTIONS_AMOUNT_PER_PAGE } from '../stores/zine/reactions'
|
|||
import authorsLoadBy from '../graphql/query/authors-load-by'
|
||||
import shoutsLoadBy from '../graphql/query/articles-load-by'
|
||||
import shoutLoad from '../graphql/query/articles-load'
|
||||
import loadRecipients from '../graphql/query/chat-recipients'
|
||||
|
||||
type ApiErrorCode =
|
||||
| 'unknown'
|
||||
|
@ -284,5 +285,8 @@ export const apiClient = {
|
|||
getChatMessages: async (options: QueryLoadMessagesByArgs) => {
|
||||
const resp = await privateGraphQLClient.query(chatMessagesLoadBy, options).toPromise()
|
||||
return resp.data.loadChat
|
||||
},
|
||||
getRecipients: async ({ limit = 50, offset = 0 }) => {
|
||||
const resp = await privateGraphQLClient.query(loadRecipients, { limit, offset })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user