mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Fixed scoped query for RSS items
This commit is contained in:
parent
6c5c3cf159
commit
f6bfdf6a93
2 changed files with 15 additions and 8 deletions
|
|
@ -2,7 +2,7 @@ import { ReactNode, useMemo } from 'react'
|
|||
import { StyledText } from '../../elements/StyledText'
|
||||
import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
|
||||
import { Button } from '../../elements/Button'
|
||||
import { CaretRight, Circle } from 'phosphor-react'
|
||||
import { Circle } from 'phosphor-react'
|
||||
import { useGetSubscriptionsQuery } from '../../../lib/networking/queries/useGetSubscriptionsQuery'
|
||||
import { useGetLabelsQuery } from '../../../lib/networking/queries/useGetLabelsQuery'
|
||||
import { Label } from '../../../lib/networking/fragments/labelFragment'
|
||||
|
|
@ -11,9 +11,7 @@ import { useRegisterActions } from 'kbar'
|
|||
import { LogoBox } from '../../elements/LogoBox'
|
||||
import { usePersistedState } from '../../../lib/hooks/usePersistedState'
|
||||
import { ToggleCaretDownIcon } from '../../elements/icons/ToggleCaretDownIcon'
|
||||
import { ToggleCaretLeftIcon } from '../../elements/icons/ToggleCaretLeftIcon'
|
||||
import Link from 'next/link'
|
||||
import { ArrowRightIcon } from '../../elements/icons/ArrowRightIcon'
|
||||
import { ToggleCaretRightIcon } from '../../elements/icons/ToggleCaretRightIcon'
|
||||
|
||||
export const LIBRARY_LEFT_MENU_WIDTH = '233px'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { gql } from 'graphql-request'
|
||||
import useSWR from 'swr'
|
||||
import { publicGqlFetcher } from '../networkHelpers'
|
||||
import { gqlFetcher, makeGqlFetcher, publicGqlFetcher } from '../networkHelpers'
|
||||
|
||||
export type SubscriptionStatus = 'ACTIVE' | 'DELETED' | 'UNSUBSCRIBED'
|
||||
|
||||
|
|
@ -39,11 +39,12 @@ type SubscriptionsData = {
|
|||
}
|
||||
|
||||
export function useGetSubscriptionsQuery(
|
||||
type: SubscriptionType | undefined,
|
||||
sortBy = 'UPDATED_TIME'
|
||||
): SubscriptionsQueryResponse {
|
||||
const query = gql`
|
||||
query GetSubscriptions {
|
||||
subscriptions(sort: { by: ${sortBy} }) {
|
||||
query GetSubscriptions($type: SubscriptionType, $sort: SortParams) {
|
||||
subscriptions(type: $type, sort: $sort) {
|
||||
... on SubscriptionsSuccess {
|
||||
subscriptions {
|
||||
id
|
||||
|
|
@ -67,9 +68,17 @@ export function useGetSubscriptionsQuery(
|
|||
}
|
||||
`
|
||||
|
||||
const { data, mutate, isValidating } = useSWR(query, publicGqlFetcher)
|
||||
|
||||
try {
|
||||
const { data, mutate, isValidating } = useSWR(
|
||||
query,
|
||||
makeGqlFetcher({
|
||||
type,
|
||||
sort: {
|
||||
by: sortBy,
|
||||
},
|
||||
})
|
||||
)
|
||||
|
||||
if (data) {
|
||||
const result = data as SubscriptionsResponseData
|
||||
const subscriptions = result.subscriptions.subscriptions as Subscription[]
|
||||
|
|
|
|||
Loading…
Reference in a new issue