diff --git a/src/components/select-dialog.tsx b/src/components/select-dialog.tsx index 629d1ad..e689782 100644 --- a/src/components/select-dialog.tsx +++ b/src/components/select-dialog.tsx @@ -32,9 +32,10 @@ class SelectDialog extends React.Component { } handlePostMessage = ( event: MessageEvent ) => { - console.log( 'PostMessage recieved:', event.data ); - this.props.onSelectForm( event.data ); - this.setState({ isOpen: false }); + if (event.origin === baseUrl && event.data.type === 'cog-form-selected') { + this.props.onSelectForm( event.data ); + this.setState({ isOpen: false }); // Close Dialog + } } render() { diff --git a/src/globals.ts b/src/globals.ts index 6f745f7..e622d97 100644 --- a/src/globals.ts +++ b/src/globals.ts @@ -1 +1 @@ -export const baseUrl: string = '//forms.cognito.test'; +export const baseUrl: string = 'https://forms.cognito.test';