From da09e084c1facc17a28f55e335d38a8c34aa88b0 Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Tue, 15 Nov 2022 19:50:15 +0300 Subject: [PATCH] working --- src/pages/index.astro | 2 +- src/stores/zine/articles.ts | 2 +- src/utils/apiClient.ts | 14 ++++++++------ src/utils/config.ts | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index 1c1ecff7..2bf6b0bd 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -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) diff --git a/src/stores/zine/articles.ts b/src/stores/zine/articles.ts index 5955c11d..9638d803 100644 --- a/src/stores/zine/articles.ts +++ b/src/stores/zine/articles.ts @@ -134,7 +134,7 @@ export const loadShoutsBy = async ({ }): Promise<{ hasMore: boolean }> => { const newArticles = await apiClient.loadShoutsBy({ by, - amount: limit + 1, + limit: limit + 1, offset }) diff --git a/src/utils/apiClient.ts b/src/utils/apiClient.ts index 851cda44..c2278311 100644 --- a/src/utils/apiClient.ts +++ b/src/utils/apiClient.ts @@ -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 ({ diff --git a/src/utils/config.ts b/src/utils/config.ts index ed2715fa..eadf4cef 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -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'