mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
Feature: Introduce locale in web-widget SDK (#871)
* Introduce setLocale in SDK Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
@@ -1,13 +1,26 @@
|
||||
const sendMessage = content => ({
|
||||
url: `/api/v1/widget/messages${window.location.search}`,
|
||||
params: {
|
||||
message: {
|
||||
content,
|
||||
timestamp: new Date().toString(),
|
||||
referer_url: window.refererURL || '',
|
||||
import Vue from 'vue';
|
||||
|
||||
const sendMessage = content => {
|
||||
const locale = Vue.config.lang;
|
||||
const refererURL = window.refererURL || '';
|
||||
let search = window.location.search;
|
||||
if (search) {
|
||||
search = `${search}&locale=${locale}`;
|
||||
} else {
|
||||
search = `?locale=${locale}`;
|
||||
}
|
||||
|
||||
return {
|
||||
url: `/api/v1/widget/messages${search}`,
|
||||
params: {
|
||||
message: {
|
||||
content,
|
||||
timestamp: new Date().toString(),
|
||||
referer_url: refererURL,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
const sendAttachment = ({ attachment }) => {
|
||||
const { refererURL = '' } = window;
|
||||
|
||||
Reference in New Issue
Block a user