This commit is contained in:
tonyrewin 2022-11-15 19:50:15 +03:00
parent 8db611bfc4
commit da09e084c1
4 changed files with 12 additions and 10 deletions

View File

@ -7,7 +7,7 @@ import { PRERENDERED_ARTICLES_COUNT } from '../components/Views/Home'
const randomTopics = await apiClient.getRandomTopics({ amount: 12 })
const articles = await apiClient.loadShoutsBy(
{ by: { visibility: "public" }, amount: PRERENDERED_ARTICLES_COUNT, offset: 0 })
{ by: { visibility: "public" }, limit: PRERENDERED_ARTICLES_COUNT, offset: 0 })
const { pathname, search } = Astro.url
initRouter(pathname, search)

View File

@ -134,7 +134,7 @@ export const loadShoutsBy = async ({
}): Promise<{ hasMore: boolean }> => {
const newArticles = await apiClient.loadShoutsBy({
by,
amount: limit + 1,
limit: limit + 1,
offset
})

View File

@ -230,16 +230,18 @@ export const apiClient = {
const resp = await privateGraphQLClient.query(myChats, payload).toPromise()
return resp.data.myChats
},
loadAuthorsBy: async ({ by, amount = 50, offset = 0 }) => {
const resp = await publicGraphQLClient.query(authorsLoadBy, { by, amount, offset }).toPromise()
loadAuthorsBy: async ({ by, limit = 50, offset = 0 }) => {
const resp = await publicGraphQLClient.query(authorsLoadBy, { by, limit, offset }).toPromise()
console.debug(resp)
return resp.data.loadShoutsBy
},
loadShoutsBy: async ({ by, amount = 50, offset = 0 }) => {
const resp = await publicGraphQLClient.query(shoutsLoadBy, { by, amount, offset }).toPromise()
loadShoutsBy: async ({ by, limit = 50, offset = 0 }) => {
const resp = await publicGraphQLClient.query(shoutsLoadBy, { by, limit, offset }).toPromise()
console.debug(resp)
return resp.data.loadShoutsBy
},
loadReactionsBy: async ({ by, amount = REACTIONS_AMOUNT_PER_PAGE, offset = 0 }) => {
const resp = await publicGraphQLClient.query(reactionsLoadBy, { by, amount, offset }).toPromise()
loadReactionsBy: async ({ by, limit = REACTIONS_AMOUNT_PER_PAGE, offset = 0 }) => {
const resp = await publicGraphQLClient.query(reactionsLoadBy, { by, limit, offset }).toPromise()
return resp.data.loadReactionsBy
},
getChatMessages: async ({

View File

@ -1,6 +1,6 @@
export const isDev = import.meta.env.MODE === 'development'
export const apiBaseUrl = 'https://testapi.discours.io'
// export const apiBaseUrl = 'https://testapi.discours.io'
// export const apiBaseUrl = 'https://newapi.discours.io'
// testapi.discours.io
//export const apiBaseUrl = 'http://localhost:8080'
export const apiBaseUrl = 'http://localhost:8080'