fix-queryname
This commit is contained in:
parent
4650469247
commit
64f8110e84
|
@ -59,7 +59,7 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
|
||||||
|
|
||||||
const loadChats = async () => {
|
const loadChats = async () => {
|
||||||
try {
|
try {
|
||||||
const newChats = await inboxClient.getChats({ limit: 50, offset: 0 })
|
const newChats = await inboxClient.loadChats({ limit: 50, offset: 0 })
|
||||||
setChats(newChats)
|
setChats(newChats)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { gql } from '@urql/core'
|
import { gql } from '@urql/core'
|
||||||
|
|
||||||
export default gql`
|
export default gql`
|
||||||
query GetChatsQuery($limit: Int, $offset: Int) {
|
query GetChatMembersQuery($limit: Int, $offset: Int) {
|
||||||
loadRecipients(limit: $limit, offset: $offset) {
|
loadRecipients(limit: $limit, offset: $offset) {
|
||||||
members {
|
members {
|
||||||
id
|
id
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
---
|
|
||||||
import './styles/app.scss'
|
|
||||||
import { Seo } from "astro-seo-meta"
|
|
||||||
|
|
||||||
const ln = Astro.url.searchParams.get('lng') || 'ru'
|
|
||||||
const { protocol, host } = Astro.url
|
|
||||||
const title = ln === 'ru' ? 'Дискурс' : 'Discours'
|
|
||||||
const imageUrl = Astro.props.imageUrl ?? `${protocol}${host}/public/bonfire.png`
|
|
||||||
const description = ln === 'ru' ? 'Горизонтальная платформа коллаборативной журналистики' : 'Horizontal collaborative journalistic platform'
|
|
||||||
---
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width" />
|
|
||||||
<Seo
|
|
||||||
title={title}
|
|
||||||
icon="favicon.png"
|
|
||||||
facebook={{
|
|
||||||
image: imageUrl,
|
|
||||||
type: "website",
|
|
||||||
}}
|
|
||||||
twitter={{
|
|
||||||
image: imageUrl,
|
|
||||||
card: description,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<slot />
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
---
|
|
||||||
import { Confirmed } from '../../components/Nav/Confirmed'
|
|
||||||
import { t } from 'i18next'
|
|
||||||
|
|
||||||
const token = Astro.params.token?.toString() || ''
|
|
||||||
---
|
|
||||||
<html>
|
|
||||||
<head><title>{t('Discours')}</title></head>
|
|
||||||
<body>
|
|
||||||
<Confirmed token={token} />
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
import i18next, { t } from "i18next"
|
|
||||||
import { Confirmed } from '../../components/Nav/Confirmed'
|
|
||||||
---
|
|
||||||
<html>
|
|
||||||
<head><title>{t('Discours')}</title></head>
|
|
||||||
<body>
|
|
||||||
<Confirmed />
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,21 +0,0 @@
|
||||||
---
|
|
||||||
import { Root } from '../../components/Root'
|
|
||||||
import Prerendered from '../../main.astro'
|
|
||||||
import { apiClient } from '../../utils/apiClient'
|
|
||||||
import { PRERENDERED_ARTICLES_COUNT } from '../../components/Views/Topic'
|
|
||||||
|
|
||||||
const slug = Astro.params.slug?.toString() || ''
|
|
||||||
const shouts = await apiClient.getShouts({ filters: { topic: slug }, limit: PRERENDERED_ARTICLES_COUNT })
|
|
||||||
const topic = await apiClient.getTopic({ slug })
|
|
||||||
|
|
||||||
import { initRouter } from '../../stores/router'
|
|
||||||
|
|
||||||
const { pathname, search } = Astro.url
|
|
||||||
initRouter(pathname, search)
|
|
||||||
|
|
||||||
Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate')
|
|
||||||
---
|
|
||||||
|
|
||||||
<Prerendered>
|
|
||||||
<Root topicShouts={shouts} topic={topic} client:load />
|
|
||||||
</Prerendered>
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { apiClient } from '../utils/apiClient'
|
import { inboxClient } from '../utils/apiClient'
|
||||||
import type { MessagesBy } from '../graphql/types.gen'
|
import type { MessagesBy } from '../graphql/types.gen'
|
||||||
|
|
||||||
export const loadRecipients = async (by = {}): Promise<void> => {
|
export const loadRecipients = async (by = {}): Promise<void> => {
|
||||||
return await apiClient.getRecipients(by)
|
return await inboxClient.loadRecipients(by)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const loadMessages = async (by: MessagesBy): Promise<void> => {
|
export const loadMessages = async (by: MessagesBy): Promise<void> => {
|
||||||
return await apiClient.getChatMessages({ by, limit: 50, offset: 0 })
|
return await inboxClient.loadChatMessages({ by, limit: 50, offset: 0 })
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,7 +352,7 @@ export const apiClient = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const inboxClient = {
|
export const inboxClient = {
|
||||||
getChats: async (options: QueryLoadChatsArgs): Promise<Chat[]> => {
|
loadChats: async (options: QueryLoadChatsArgs): Promise<Chat[]> => {
|
||||||
const resp = await privateInboxGraphQLClient.query(myChats, options).toPromise()
|
const resp = await privateInboxGraphQLClient.query(myChats, options).toPromise()
|
||||||
return resp.data.loadChats.chats
|
return resp.data.loadChats.chats
|
||||||
},
|
},
|
||||||
|
@ -367,11 +367,11 @@ export const inboxClient = {
|
||||||
return resp.data.createMessage.message
|
return resp.data.createMessage.message
|
||||||
},
|
},
|
||||||
|
|
||||||
getChatMessages: async (options: QueryLoadMessagesByArgs) => {
|
loadChatMessages: async (options: QueryLoadMessagesByArgs) => {
|
||||||
const resp = await privateInboxGraphQLClient.query(chatMessagesLoadBy, options).toPromise()
|
const resp = await privateInboxGraphQLClient.query(chatMessagesLoadBy, options).toPromise()
|
||||||
return resp.data.loadMessagesBy.messages
|
return resp.data.loadMessagesBy.messages
|
||||||
},
|
},
|
||||||
getRecipients: async (options: QueryLoadRecipientsArgs) => {
|
loadRecipients: async (options: QueryLoadRecipientsArgs) => {
|
||||||
const resp = await privateInboxGraphQLClient.query(loadRecipients, options).toPromise()
|
const resp = await privateInboxGraphQLClient.query(loadRecipients, options).toPromise()
|
||||||
return resp.data.loadRecipients.members
|
return resp.data.loadRecipients.members
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user