Skip to content

Commit

Permalink
replace amplify.register with amplify.configure
Browse files Browse the repository at this point in the history
  • Loading branch information
david-mcafee committed Sep 1, 2023
1 parent daeac44 commit 1d88977
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 6 deletions.
10 changes: 9 additions & 1 deletion packages/api-graphql/src/GraphQLAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
9 changes: 8 additions & 1 deletion packages/api-graphql/src/internals/InternalGraphQLAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
11 changes: 10 additions & 1 deletion packages/api-rest/src/RestAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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);
10 changes: 9 additions & 1 deletion packages/api/src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,12 @@ declare type V6Client<T extends Record<any, any> = 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);
10 changes: 9 additions & 1 deletion packages/api/src/internals/InternalAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
3 changes: 2 additions & 1 deletion packages/core/src/singleton/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import {
StorageConfig,
} from './Storage/types';

// TODO V6: API types??
export type ResourcesConfig = {
// API?: {};
API?: {};
Analytics?: AnalyticsConfig;
Auth?: AuthConfig;
// Cache?: CacheConfig;
Expand Down

0 comments on commit 1d88977

Please sign in to comment.