filter-format-fix
This commit is contained in:
parent
7bc743d8a7
commit
fce0d7cfc6
|
@ -1,6 +1,7 @@
|
|||
import { createMemo, createSignal, For, onMount, Show } from 'solid-js'
|
||||
|
||||
import { useLocalize } from '../../context/localize'
|
||||
import { Shout } from '../../graphql/schema/core.gen'
|
||||
import {
|
||||
loadShouts,
|
||||
loadTopArticles,
|
||||
|
@ -22,7 +23,6 @@ import { Row3 } from '../Feed/Row3'
|
|||
import { Row5 } from '../Feed/Row5'
|
||||
import RowShort from '../Feed/RowShort'
|
||||
import { Topics } from '../Nav/Topics'
|
||||
import { Shout } from '../../graphql/schema/core.gen'
|
||||
|
||||
type Props = {
|
||||
shouts: Shout[]
|
||||
|
|
|
@ -3,6 +3,7 @@ import type { Author, Result } from '../graphql/schema/core.gen'
|
|||
import type { Accessor, JSX, Resource } from 'solid-js'
|
||||
|
||||
import { VerifyEmailInput, LoginInput, AuthToken, User } from '@authorizerdev/authorizer-js'
|
||||
import { cookieStorage, createStorage } from '@solid-primitives/storage'
|
||||
import { createContext, createMemo, createResource, createSignal, onMount, useContext } from 'solid-js'
|
||||
|
||||
import { apiClient } from '../graphql/client/core'
|
||||
|
@ -11,7 +12,6 @@ import { showModal } from '../stores/ui'
|
|||
import { useAuthorizer } from './authorizer'
|
||||
import { useLocalize } from './localize'
|
||||
import { useSnackbar } from './snackbar'
|
||||
import { cookieStorage, createStorage } from '@solid-primitives/storage'
|
||||
|
||||
export type SessionContextType = {
|
||||
session: Resource<AuthToken>
|
||||
|
|
|
@ -11,7 +11,6 @@ import type {
|
|||
Result,
|
||||
QueryLoad_Authors_ByArgs,
|
||||
QueryLoad_Shouts_SearchArgs,
|
||||
QueryLoad_Shouts_ByArgs,
|
||||
} from '../schema/core.gen'
|
||||
|
||||
import createArticle from '../mutation/core/article-create'
|
||||
|
@ -27,9 +26,9 @@ import { getPrivateClient } from '../privateGraphQLClient'
|
|||
import { getPublicClient } from '../publicGraphQLClient'
|
||||
import shoutLoad from '../query/core/article-load'
|
||||
import shoutsLoadBy from '../query/core/articles-load-by'
|
||||
import shoutsLoadSearch from '../query/core/articles-load-search'
|
||||
import draftsLoad from '../query/core/articles-load-drafts'
|
||||
import myFeed from '../query/core/articles-load-feed'
|
||||
import shoutsLoadSearch from '../query/core/articles-load-search'
|
||||
import authorBy from '../query/core/author-by'
|
||||
import authorFollowers from '../query/core/author-followers'
|
||||
import authorsAll from '../query/core/authors-all'
|
||||
|
@ -148,61 +147,38 @@ export const apiClient = {
|
|||
console.debug('[graphql.client.core] updateReaction:', response)
|
||||
return response.data.update_reaction.reaction
|
||||
},
|
||||
getAuthorsBy: async (options: QueryLoad_Authors_ByArgs) => {
|
||||
const resp = await publicGraphQLClient.query(authorsLoadBy, options).toPromise()
|
||||
getAuthorsBy: async (args: QueryLoad_Authors_ByArgs) => {
|
||||
const resp = await publicGraphQLClient.query(authorsLoadBy, args).toPromise()
|
||||
return resp.data.load_authors_by
|
||||
},
|
||||
getShoutBySlug: async (slug: string) => {
|
||||
const resp = await publicGraphQLClient
|
||||
.query(shoutLoad, {
|
||||
slug,
|
||||
})
|
||||
.toPromise()
|
||||
|
||||
// if (resp.error) {
|
||||
// console.error(resp)
|
||||
// }
|
||||
|
||||
const resp = await publicGraphQLClient.query(shoutLoad, { slug }).toPromise()
|
||||
return resp.data.get_shout
|
||||
},
|
||||
getShoutById: async (shout_id: number) => {
|
||||
const resp = await publicGraphQLClient
|
||||
.query(shoutLoad, {
|
||||
shout_id,
|
||||
})
|
||||
.toPromise()
|
||||
|
||||
if (resp.error) {
|
||||
console.error(resp)
|
||||
}
|
||||
const resp = await publicGraphQLClient.query(shoutLoad, { shout_id }).toPromise()
|
||||
if (resp.error) console.error(resp)
|
||||
|
||||
return resp.data.get_shout
|
||||
},
|
||||
|
||||
getShouts: async (args: QueryLoad_Shouts_ByArgs) => {
|
||||
const resp = await publicGraphQLClient.query(shoutsLoadBy, args).toPromise()
|
||||
if (resp.error) {
|
||||
console.error(resp)
|
||||
}
|
||||
getShouts: async (options: LoadShoutsOptions) => {
|
||||
const resp = await publicGraphQLClient.query(shoutsLoadBy, { options }).toPromise()
|
||||
if (resp.error) console.error(resp)
|
||||
|
||||
return resp.data.load_shouts_by
|
||||
},
|
||||
|
||||
getShoutsSearch: async (args: QueryLoad_Shouts_SearchArgs) => {
|
||||
const resp = await publicGraphQLClient.query(shoutsLoadSearch, args).toPromise()
|
||||
if (resp.error) {
|
||||
console.error(resp)
|
||||
}
|
||||
if (resp.error) console.error(resp)
|
||||
|
||||
return resp.data.load_shouts_search
|
||||
},
|
||||
|
||||
getMyFeed: async (args: QueryLoad_Shouts_ByArgs) => {
|
||||
const resp = await privateGraphQLClient.query(myFeed, args).toPromise()
|
||||
|
||||
if (resp.error) {
|
||||
console.error(resp)
|
||||
}
|
||||
getMyFeed: async (options: LoadShoutsOptions) => {
|
||||
const resp = await privateGraphQLClient.query(myFeed, { options }).toPromise()
|
||||
if (resp.error) console.error(resp)
|
||||
|
||||
return resp.data.load_shouts_feed
|
||||
},
|
||||
|
@ -215,7 +191,7 @@ export const apiClient = {
|
|||
},
|
||||
getMySubscriptions: async (): Promise<Result> => {
|
||||
const resp = await privateGraphQLClient.query(mySubscriptions, {}).toPromise()
|
||||
// console.debug(resp.data)
|
||||
|
||||
return resp.data.get_my_followed
|
||||
},
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ export const onBeforeRender = async (pageContext: PageContext) => {
|
|||
if (!author) {
|
||||
throw render(404)
|
||||
}
|
||||
const options = {
|
||||
filters: { author: slug, visibility: 'community' },
|
||||
|
||||
const authorShouts = await apiClient.getShouts({
|
||||
filters: { author: slug, published: false },
|
||||
limit: PRERENDERED_ARTICLES_COUNT,
|
||||
}
|
||||
const authorShouts = await apiClient.getShouts({ options })
|
||||
})
|
||||
const pageProps: PageProps = { author, authorShouts, seo: { title: author.name } }
|
||||
|
||||
return {
|
||||
|
|
|
@ -5,11 +5,10 @@ import { PRERENDERED_ARTICLES_COUNT } from '../../components/Views/Expo/Expo'
|
|||
import { apiClient } from '../../graphql/client/core'
|
||||
|
||||
export const onBeforeRender = async (_pageContext: PageContext) => {
|
||||
const options = {
|
||||
const expoShouts = await apiClient.getShouts({
|
||||
filters: { layouts: ['audio', 'video', 'literature', 'image'] },
|
||||
limit: PRERENDERED_ARTICLES_COUNT,
|
||||
}
|
||||
const expoShouts = await apiClient.getShouts({ options })
|
||||
})
|
||||
const pageProps: PageProps = { expoShouts, seo: { title: '' } }
|
||||
return {
|
||||
pageContext: {
|
||||
|
|
|
@ -10,7 +10,7 @@ export const onBeforeRender = async (pageContext: PageContext) => {
|
|||
filters: { layouts: [layout] },
|
||||
limit: PRERENDERED_ARTICLES_COUNT,
|
||||
}
|
||||
const expoShouts = await apiClient.getShouts({ options })
|
||||
const expoShouts = await apiClient.getShouts(options)
|
||||
const pageProps: PageProps = { expoShouts, seo: { title: '' } }
|
||||
|
||||
return {
|
||||
|
|
|
@ -5,11 +5,10 @@ import { PRERENDERED_ARTICLES_COUNT } from '../components/Views/Home'
|
|||
import { apiClient } from '../graphql/client/core'
|
||||
|
||||
export const onBeforeRender = async (_pageContext: PageContext) => {
|
||||
const options = {
|
||||
const homeShouts = await apiClient.getShouts({
|
||||
filters: { published: true },
|
||||
limit: PRERENDERED_ARTICLES_COUNT,
|
||||
}
|
||||
const homeShouts = await apiClient.getShouts({ options })
|
||||
})
|
||||
const pageProps: PageProps = { homeShouts, seo: { title: '' } }
|
||||
|
||||
return {
|
||||
|
|
|
@ -4,10 +4,8 @@ import type { PageContext } from '../renderer/types'
|
|||
import { apiClient } from '../graphql/client/core'
|
||||
|
||||
export const onBeforeRender = async (pageContext: PageContext) => {
|
||||
const { q } = pageContext.routeParams
|
||||
|
||||
const searchResults = await apiClient.getShoutsSearch({ text: q, limit: 50 })
|
||||
|
||||
const { q: text } = pageContext.routeParams
|
||||
const searchResults = await apiClient.getShoutsSearch({ text, limit: 50 })
|
||||
const pageProps: PageProps = { searchResults, seo: { title: '' } }
|
||||
|
||||
return {
|
||||
|
|
|
@ -138,7 +138,7 @@ export const loadShouts = async (
|
|||
options: LoadShoutsOptions,
|
||||
): Promise<{ hasMore: boolean; newShouts: Shout[] }> => {
|
||||
options.limit += 1
|
||||
const newShouts = await apiClient.getShouts({ options })
|
||||
const newShouts = await apiClient.getShouts(options)
|
||||
const hasMore = newShouts ?? newShouts.length === options.limit + 1
|
||||
|
||||
if (hasMore) {
|
||||
|
@ -155,7 +155,7 @@ export const loadMyFeed = async (
|
|||
options: LoadShoutsOptions,
|
||||
): Promise<{ hasMore: boolean; newShouts: Shout[] }> => {
|
||||
options.limit += 1
|
||||
const newShouts = await apiClient.getMyFeed({ options })
|
||||
const newShouts = await apiClient.getMyFeed(options)
|
||||
const hasMore = newShouts ?? newShouts.length === options.limit + 1
|
||||
|
||||
if (hasMore) {
|
||||
|
@ -197,7 +197,7 @@ export const loadTopMonthArticles = async (): Promise<void> => {
|
|||
order_by: 'rating_stat',
|
||||
limit: TOP_MONTH_ARTICLES_COUNT,
|
||||
}
|
||||
const articles = await apiClient.getShouts({ options })
|
||||
const articles = await apiClient.getShouts(options)
|
||||
addArticles(articles)
|
||||
setTopMonthArticles(articles)
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ export const loadTopArticles = async (): Promise<void> => {
|
|||
order_by: 'rating_stat',
|
||||
limit: TOP_ARTICLES_COUNT,
|
||||
}
|
||||
const articles = await apiClient.getShouts({ options })
|
||||
const articles = await apiClient.getShouts(options)
|
||||
addArticles(articles)
|
||||
setTopArticles(articles)
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ export const resetSortedLayoutShouts = () => {
|
|||
|
||||
export const loadLayoutShoutsBy = async (options: LoadShoutsOptions): Promise<{ hasMore: boolean }> => {
|
||||
options.limit += 1
|
||||
const newLayoutShouts = await apiClient.getShouts({ options })
|
||||
const newLayoutShouts = await apiClient.getShouts(options)
|
||||
const hasMore = newLayoutShouts.length === options.limit + 1
|
||||
|
||||
if (hasMore) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user