diff options
Diffstat (limited to 'frontend/src/components')
| -rw-r--r-- | frontend/src/components/AddFeedForm.tsx | 4 | ||||
| -rw-r--r-- | frontend/src/components/ArticleItem.tsx | 8 | ||||
| -rw-r--r-- | frontend/src/components/FeedItem.tsx | 8 | ||||
| -rw-r--r-- | frontend/src/components/FeedList.tsx | 3 |
4 files changed, 16 insertions, 7 deletions
diff --git a/frontend/src/components/AddFeedForm.tsx b/frontend/src/components/AddFeedForm.tsx index 519f9e3..6d18318 100644 --- a/frontend/src/components/AddFeedForm.tsx +++ b/frontend/src/components/AddFeedForm.tsx @@ -8,6 +8,8 @@ interface Props { onFeedAdded?: () => void; } +const urqlContextFeed = { additionalTypenames: ["Feed"] }; + export function AddFeedForm({ onFeedAdded }: Props) { const [url, setUrl] = useState(""); const [error, setError] = useState<string | null>(null); @@ -20,7 +22,7 @@ export function AddFeedForm({ onFeedAdded }: Props) { setError(null); try { - const result = await addFeed({ url: url.trim() }); + const result = await addFeed({ url: url.trim() }, urqlContextFeed); if (result.error) { setError(result.error.message); } else if (result.data) { diff --git a/frontend/src/components/ArticleItem.tsx b/frontend/src/components/ArticleItem.tsx index 4942518..c61923a 100644 --- a/frontend/src/components/ArticleItem.tsx +++ b/frontend/src/components/ArticleItem.tsx @@ -20,6 +20,8 @@ interface Props { onReadChange?: (articleId: string, isRead: boolean) => void; } +const urqlContextArticle = { additionalTypenames: ["Article"] }; + export function ArticleItem({ article, onReadChange }: Props) { const [, markArticleRead] = useMutation(MarkArticleReadDocument); const [, markArticleUnread] = useMutation(MarkArticleUnreadDocument); @@ -32,9 +34,9 @@ export function ArticleItem({ article, onReadChange }: Props) { onReadChange?.(articleId, newReadState); if (isCurrentlyRead) { - await markArticleUnread({ id: articleId }); + await markArticleUnread({ id: articleId }, urqlContextArticle); } else { - await markArticleRead({ id: articleId }); + await markArticleRead({ id: articleId }, urqlContextArticle); } }; @@ -43,7 +45,7 @@ export function ArticleItem({ article, onReadChange }: Props) { window.open(article.url, "_blank", "noreferrer"); if (!article.isRead) { onReadChange?.(article.id, true); - await markArticleRead({ id: article.id }); + await markArticleRead({ id: article.id }, urqlContextArticle); } }; diff --git a/frontend/src/components/FeedItem.tsx b/frontend/src/components/FeedItem.tsx index 29cd531..80c8992 100644 --- a/frontend/src/components/FeedItem.tsx +++ b/frontend/src/components/FeedItem.tsx @@ -15,17 +15,19 @@ interface Props { onFeedUnsubscribed?: () => void; } +const urqlContextFeed = { additionalTypenames: ["Feed"] }; + export function FeedItem({ feed, onFeedUnsubscribed }: Props) { const [, markFeedRead] = useMutation(MarkFeedReadDocument); const [, markFeedUnread] = useMutation(MarkFeedUnreadDocument); const [, unsubscribeFeed] = useMutation(UnsubscribeFeedDocument); const handleMarkAllRead = async (feedId: string) => { - await markFeedRead({ id: feedId }); + await markFeedRead({ id: feedId }, urqlContextFeed); }; const handleMarkAllUnread = async (feedId: string) => { - await markFeedUnread({ id: feedId }); + await markFeedUnread({ id: feedId }, urqlContextFeed); }; const handleUnsubscribeFeed = async (feedId: string) => { @@ -33,7 +35,7 @@ export function FeedItem({ feed, onFeedUnsubscribed }: Props) { "Are you sure you want to unsubscribe from this feed?", ); if (confirmed) { - await unsubscribeFeed({ id: feedId }); + await unsubscribeFeed({ id: feedId }, urqlContextFeed); onFeedUnsubscribed?.(); } }; diff --git a/frontend/src/components/FeedList.tsx b/frontend/src/components/FeedList.tsx index d1d7bf3..6081293 100644 --- a/frontend/src/components/FeedList.tsx +++ b/frontend/src/components/FeedList.tsx @@ -6,9 +6,12 @@ interface Props { onFeedUnsubscribed?: () => void; } +const urqlContextFeed = { additionalTypenames: ["Feed"] }; + export function FeedList({ onFeedUnsubscribed }: Props) { const [{ data, fetching, error }] = useQuery({ query: GetFeedsDocument, + context: urqlContextFeed, }); if (fetching) { |
