fix: handle token expiry (#3847)

This commit is contained in:
Erez Rokah
2020-06-03 12:44:03 +03:00
committed by GitHub
parent 43ef28b5dc
commit 285c940562
20 changed files with 282 additions and 17 deletions

View File

@ -0,0 +1,11 @@
export const ACCESS_TOKEN_ERROR = 'ACCESS_TOKEN_ERROR';
export default class AccessTokenError extends Error {
message: string;
constructor(message: string) {
super(message);
this.message = message;
this.name = ACCESS_TOKEN_ERROR;
}
}

View File

@ -84,6 +84,8 @@ export type Config = {
large_media_url?: string;
use_large_media_transforms_in_media_library?: boolean;
proxy_url?: string;
auth_type?: string;
app_id?: string;
};
media_folder: string;
base_url?: string;
@ -139,6 +141,7 @@ export interface Implementation {
) => Promise<{ entries: ImplementationEntry[]; cursor: Cursor }>;
isGitBackend?: () => boolean;
status: () => Promise<{ auth: boolean }>;
}
const MAX_CONCURRENT_DOWNLOADS = 10;

View File

@ -1,6 +1,7 @@
import APIError from './APIError';
import Cursor, { CURSOR_COMPATIBILITY_SYMBOL } from './Cursor';
import EditorialWorkflowError, { EDITORIAL_WORKFLOW_ERROR } from './EditorialWorkflowError';
import AccessTokenError from './AccessTokenError';
import localForage from './localForage';
import { isAbsolutePath, basename, fileExtensionWithSeparator, fileExtension } from './path';
import { onlySuccessfulPromises, flowAsync, then } from './promise';
@ -138,6 +139,7 @@ export const NetlifyCmsLibUtil = {
blobToFileObj,
requestWithBackoff,
allEntriesByFolder,
AccessTokenError,
};
export {
APIError,
@ -192,4 +194,5 @@ export {
blobToFileObj,
requestWithBackoff,
allEntriesByFolder,
AccessTokenError,
};