Merge pull request #987 from gobigfoot/patch/react-bot-framework

Patch issue #871. Added componentDidMount
This commit is contained in:
Laura Kokkarinen 2019-10-02 14:06:59 +03:00 committed by GitHub
commit c6354074d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 25 deletions

View File

@ -35,8 +35,17 @@ export default class BotFrameworkChat extends React.Component<IBotFrameworkChatP
);
}
public componentDidMount(){
this.initSwagger();
}
public componentDidUpdate(prevProps: IBotFrameworkChatProps, prevState: {}, prevContext: any): void {
if (this.props.directLineSecret !== prevProps.directLineSecret) {
this.initSwagger();
}
}
public initSwagger(){
if (this.props.directLineSecret) {
var Swagger = require('swagger-client');
var directLineSpec = require('./directline-swagger.json');
@ -68,7 +77,6 @@ export default class BotFrameworkChat extends React.Component<IBotFrameworkChatP
this.printMessage = this.printMessage.bind(this);
}
}
}
public getMessagesHtml() {
return this.messagesHtml;