diff --git a/src/components/ResponseContext.tsx b/src/components/ResponseContext.tsx index f4dff15d1c..39e4df967a 100644 --- a/src/components/ResponseContext.tsx +++ b/src/components/ResponseContext.tsx @@ -18,6 +18,10 @@ export class ResponseInfo { isAccessDeniedError(): boolean { return this.status === 401 || this.status === 403; } + + isGoneError(): boolean { + return this.status === 410; + } } const ResponseContext = createContext(undefined); diff --git a/src/containers/PlainArticlePage/PlainArticlePage.tsx b/src/containers/PlainArticlePage/PlainArticlePage.tsx index cd6e52c795..8a94757b93 100644 --- a/src/containers/PlainArticlePage/PlainArticlePage.tsx +++ b/src/containers/PlainArticlePage/PlainArticlePage.tsx @@ -58,12 +58,9 @@ const PlainArticlePage = () => { if (loading) { return ; } - if (error?.graphQLErrors.some((err) => err.extensions.status === 410) && redirectContext) { - redirectContext.status = 410; - return ; - } - - if (responseContext?.status === 410) { + const has410Error = error?.graphQLErrors.some((err) => err.extensions.status === 410); + if (has410Error || responseContext?.isGoneError()) { + if (redirectContext) redirectContext.status = 410; return ; }