File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -92,11 +92,21 @@ export type ConfigWithDefaults = Config &
9292 Pick < Config , "storage" | "crypto" | "fetch" | "location" | "history" >
9393 > ;
9494
95+ type ConfigInput = Omit < Config , "cognitoIdpEndpoint" > &
96+ Partial < Pick < Config , "cognitoIdpEndpoint" > > ;
9597let config_ : ConfigWithDefaults | undefined = undefined ;
96- export function configure ( config ?: Config ) {
98+ export function configure ( config ?: ConfigInput ) {
9799 if ( config ) {
100+ const cognitoIdpEndpoint =
101+ config . cognitoIdpEndpoint || config . userPoolId ?. split ( "_" ) [ 0 ] ;
102+ if ( ! cognitoIdpEndpoint ) {
103+ throw new Error (
104+ "Invalid configuration provided: either cognitoIdpEndpoint or userPoolId must be provided"
105+ ) ;
106+ }
98107 config_ = {
99108 ...config ,
109+ cognitoIdpEndpoint,
100110 crypto : config . crypto ?? Defaults . crypto ,
101111 storage : config . storage ?? Defaults . storage ,
102112 fetch : config . fetch ?? Defaults . fetch ,
You can’t perform that action at this time.
0 commit comments