chore: add post message event for sending cookie to rn widget (#1860)

This commit is contained in:
Muhsin Keloth 2021-03-05 21:47:38 -08:00 committed by GitHub
parent 9e8a943ec7
commit d8cb03525f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,6 +59,16 @@ export default {
this.fetchAvailableAgents(websiteToken);
this.setLocale(getLocale(window.location.search));
}
// Pass cookie to react native widget
if (window.ReactNativeWebView) {
this.registerListeners();
window.ReactNativeWebView.postMessage(
JSON.stringify({
type: 'auth-token',
value: window.authToken,
})
);
}
this.$store.dispatch('conversationAttributes/get');
this.setWidgetColor(window.chatwootWebChannel);
this.registerUnreadEvents();