Remove duplicated functtion
This commit is contained in:
parent
377147f5a1
commit
dd6f261f78
2 changed files with 2 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue