diff --git a/src/auth/errors.ts b/src/auth/errors.ts index c42a2dfa2..4ced5f7a0 100644 --- a/src/auth/errors.ts +++ b/src/auth/errors.ts @@ -11,10 +11,6 @@ export function isJwtError(error: GraphQLError): boolean { return !!findValueInEnum(error.extensions.exception.code, JWTError); } -export function isJwtExpiredError(error: GraphQLError): boolean { - return error.extensions.exception.code === JWTError.expired; -} - export function isTokenExpired(error: GraphQLError): boolean { return error.extensions.exception.code === JWTError.expired; } diff --git a/src/auth/utils.ts b/src/auth/utils.ts index 9ce9a6b23..4ea5c4afb 100644 --- a/src/auth/utils.ts +++ b/src/auth/utils.ts @@ -4,7 +4,7 @@ import { commonMessages } from "@saleor/intl"; import { ApolloError } from "apollo-client"; import { IntlShape } from "react-intl"; -import { isJwtError, isJwtExpiredError } from "./errors"; +import { isJwtError, isTokenExpired } from "./errors"; export enum TOKEN_STORAGE_KEY { AUTH = "auth", @@ -60,7 +60,7 @@ export async function handleQueryAuthError( intl: IntlShape ) { if (error.graphQLErrors.some(isJwtError)) { - if (error.graphQLErrors.every(isJwtExpiredError)) { + if (error.graphQLErrors.every(isTokenExpired)) { const success = await tokenRefresh(); if (!success) {