Skip to content

Commit

Permalink
Merge pull request #12 from bottenderjs/connect
Browse files Browse the repository at this point in the history
Add FacebookClient connect method
  • Loading branch information
chentsulin authored Dec 1, 2017
2 parents 3a05ad7 + 183e198 commit ade1344
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/FacebookClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ function handleError(err) {
}

export default class FacebookClient extends MessengerClient {
static connect = (
accessToken: string,
version?: string = '2.11'
): FacebookClient => new FacebookClient(accessToken, version);

constructor(accessToken: string, version?: string = '2.11') {
super(accessToken, version);
}
Expand Down
2 changes: 1 addition & 1 deletion src/FacebookConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class FacebookConnector extends MessengerConnector {
client,
mapPageToAccessToken,
}: ConstructorOptions) {
const _client = client || FacebookClient.connect(accessToken);
const _client = client || FacebookClient.connect(accessToken || '');
super({ accessToken, appSecret, client: _client, mapPageToAccessToken });
}

Expand Down

0 comments on commit ade1344

Please sign in to comment.