Remove duplicated functtion

This commit is contained in:
dominik-zeglen 2020-07-27 11:39:00 +02:00
parent 377147f5a1
commit dd6f261f78
2 changed files with 2 additions and 6 deletions

View file

@ -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;
}

View file

@ -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) {