diff --git a/packages/api-graphql/src/GraphQLAPI.ts b/packages/api-graphql/src/GraphQLAPI.ts index f2a96995eb8..9567af4e694 100644 --- a/packages/api-graphql/src/GraphQLAPI.ts +++ b/packages/api-graphql/src/GraphQLAPI.ts @@ -40,4 +40,12 @@ export class GraphQLAPIClass extends InternalGraphQLAPIClass { } export const GraphQLAPI = new GraphQLAPIClass(null); -Amplify.register(GraphQLAPI); +// Amplify.register(GraphQLAPI); + +// Get access to the current back-end resource config: +const config = Amplify.getConfig(); + +// TODO V6: is this needed? +// Hub.listen('config', async config => RestAPI.configure(config.)); + +Amplify.configure(config); diff --git a/packages/api-graphql/src/internals/InternalGraphQLAPI.ts b/packages/api-graphql/src/internals/InternalGraphQLAPI.ts index deeb7ea7749..0f1db3785f9 100644 --- a/packages/api-graphql/src/internals/InternalGraphQLAPI.ts +++ b/packages/api-graphql/src/internals/InternalGraphQLAPI.ts @@ -467,4 +467,11 @@ export class InternalGraphQLAPIClass { } export const InternalGraphQLAPI = new InternalGraphQLAPIClass(null); -Amplify.register(InternalGraphQLAPI); +// Amplify.register(InternalGraphQLAPI); +// Get access to the current back-end resource config: +const config = Amplify.getConfig(); + +// TODO V6: is this needed? +// Hub.listen('config', async config => RestAPI.configure(config.)); + +Amplify.configure(config); diff --git a/packages/api-rest/src/RestAPI.ts b/packages/api-rest/src/RestAPI.ts index 7aa37753b40..58a0a318841 100644 --- a/packages/api-rest/src/RestAPI.ts +++ b/packages/api-rest/src/RestAPI.ts @@ -8,6 +8,7 @@ import { } from '@aws-amplify/core'; import { ConsoleLogger as Logger } from '@aws-amplify/core/internals/utils'; import { ApiInfo } from './types'; +import { Hub } from '@aws-amplify/core'; const logger = new Logger('RestAPI'); @@ -336,4 +337,12 @@ export class RestAPIClass { } export const RestAPI = new RestAPIClass(null); -Amplify.register(RestAPI); +// Amplify.register(RestAPI); + +// Get access to the current back-end resource config: +const config = Amplify.getConfig(); + +// TODO V6: is this needed? + +// Hub.listen('config', async config => RestAPI.configure(config.)); +Amplify.configure(config); diff --git a/packages/api/src/API.ts b/packages/api/src/API.ts index 87c605072cc..640403def71 100644 --- a/packages/api/src/API.ts +++ b/packages/api/src/API.ts @@ -281,4 +281,12 @@ declare type V6Client = never> = ExcludeNeverFields<{ }>; export const API = new APIClass(null); -Amplify.register(API); +// Amplify.register(API); + +// Get access to the current back-end resource config: +const config = Amplify.getConfig(); + +// TODO V6: is this needed? +// Hub.listen('config', async config => RestAPI.configure(config.)); + +Amplify.configure(config); diff --git a/packages/api/src/internals/InternalAPI.ts b/packages/api/src/internals/InternalAPI.ts index 118787d4ed5..4c8e623bc4a 100644 --- a/packages/api/src/internals/InternalAPI.ts +++ b/packages/api/src/internals/InternalAPI.ts @@ -294,4 +294,12 @@ export class InternalAPIClass { } export const InternalAPI = new InternalAPIClass(null); -Amplify.register(InternalAPI); +// Amplify.register(InternalAPI); + +// Get access to the current back-end resource config: +const config = Amplify.getConfig(); + +// TODO V6: is this needed? +// Hub.listen('config', async config => RestAPI.configure(config.)); + +Amplify.configure(config); diff --git a/packages/core/src/singleton/types.ts b/packages/core/src/singleton/types.ts index 8ad0bddb01a..6bcb0566c17 100644 --- a/packages/core/src/singleton/types.ts +++ b/packages/core/src/singleton/types.ts @@ -17,8 +17,9 @@ import { StorageConfig, } from './Storage/types'; +// TODO V6: API types?? export type ResourcesConfig = { - // API?: {}; + API?: {}; Analytics?: AnalyticsConfig; Auth?: AuthConfig; // Cache?: CacheConfig;