mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Better handling of article fetch errors
This commit is contained in:
parent
912210a097
commit
33fe595834
1 changed files with 7 additions and 3 deletions
|
|
@ -1,6 +1,11 @@
|
|||
import { gql } from 'graphql-request'
|
||||
import useSWRImmutable, { Cache } from 'swr'
|
||||
import { gqlFetcher, makeGqlFetcher, RequestContext, ssrFetcher } from "../networkHelpers"
|
||||
import {
|
||||
gqlFetcher,
|
||||
makeGqlFetcher,
|
||||
RequestContext,
|
||||
ssrFetcher,
|
||||
} from '../networkHelpers'
|
||||
import {
|
||||
articleFragment,
|
||||
ContentReader,
|
||||
|
|
@ -130,14 +135,13 @@ export function useGetArticleQuery({
|
|||
mutate: mutate,
|
||||
articleData: resultData,
|
||||
isLoading: !error && !data,
|
||||
articleFetchError: resultError ? (resultError as string[]) : null,
|
||||
articleFetchError: resultError ? Array(resultError) : null,
|
||||
}
|
||||
}
|
||||
|
||||
export async function articleQuery(
|
||||
input: ArticleQueryInput
|
||||
): Promise<ArticleAttributes | undefined> {
|
||||
|
||||
const result = (await gqlFetcher(query, input)) as ArticleData
|
||||
if (result.article) {
|
||||
return result.article.article
|
||||
|
|
|
|||
Loading…
Reference in a new issue