Skip to content

Commit

Permalink
Merge pull request axa-group#837 from axa-group/feature/locale_at_rest
Browse files Browse the repository at this point in the history
feat: locale can be set at rest connector token creation
Jesús Seijas authored Feb 3, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 01837ad + 50d1f1c commit 760601b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/rest-connector/src/rest-connector.js
Original file line number Diff line number Diff line change
@@ -50,7 +50,19 @@ class RestConnector extends Connector {

server.get(`${this.settings.apiTag}/token`, async (req, res) => {
this.log('debug', `GET ${this.settings.apiTag}/token`);
res.status(200).send({ id: uuid() });
const id = uuid();
if (req.query && req.query.locale) {
const contextManager = this.container.get('context-manager');
if (contextManager) {
const activity = { address: { conversation: { id } } };
const context = await contextManager.getContext({ activity });
if (context) {
context.locale = req.query.locale;
}
await contextManager.setContext({ activity }, context);
}
}
res.status(200).send({ id });
});

server.get(`${this.settings.apiTag}/talk`, async (req, res) => {

0 comments on commit 760601b

Please sign in to comment.