Skip to content

Commit

Permalink
Merge branch 'main' into signInWithRedirect-error
Browse files Browse the repository at this point in the history
  • Loading branch information
israx committed Dec 1, 2023
2 parents 055ffcf + 38282bb commit c0cec3e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/aws-amplify/src/initSingleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@ import {
} from './auth/cognito';

export const DefaultAmplify = {
/**
* Configures Amplify with the {@link resourceConfig} and {@link libraryOptions}.
*
* @param resourceConfig The {@link ResourcesConfig} object that is typically imported from the
* `amplifyconfiguration.json` file. It can also be an object literal created inline when calling `Amplify.configure`.
* @param libraryOptions The {@link LibraryOptions} additional options for the library.
*
* @example
* import config from './amplifyconfiguration.json';
*
* Amplify.configure(config);
*/
configure(
resourceConfig: ResourcesConfig | LegacyConfig,
libraryOptions?: LibraryOptions
) {
): void {
let resolvedResourceConfig: ResourcesConfig;

if (Object.keys(resourceConfig).some(key => key.startsWith('aws_'))) {
Expand Down Expand Up @@ -81,6 +93,12 @@ export const DefaultAmplify = {
// configured libraryOptions.
Amplify.configure(resolvedResourceConfig);
},
/**
* Returns the {@link ResourcesConfig} object passed in as the `resourceConfig` parameter when calling
* `Amplify.configure`.
*
* @returns An {@link ResourcesConfig} object.
*/
getConfig(): ResourcesConfig {
return Amplify.getConfig();
},
Expand Down

0 comments on commit c0cec3e

Please sign in to comment.