@phonghq/go-chat 1.0.38 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,6 @@ export const getProfile = async () => {
41
41
  export const checkTenantPhone = async () => {
42
42
  const id = localStorage.getItem('chat_id');
43
43
  const res = await axios.get(`/api/v1/message/tenant/get-info?tenant_name=${id}`);
44
- console.log(res, '5555555555555555');
45
44
  if (res.error || !res?.data)
46
45
  throw new Error(res.error);
47
46
  if (dataProfile.value)
@@ -1,5 +1,7 @@
1
1
  import axios from '../../plugins/axios';
2
2
  import { dataProfile } from '../../utils/chat/auth';
3
+ import { useError } from '../../composable/useError';
4
+ const { showError } = useError();
3
5
  const BARE_WEBSOCKET_URL = 'https://web-socket.dev01.dtsmart.dev';
4
6
  // const BARE_WEBSOCKET_URL = 'https://web-socket-test.dev01.dtsmart.dev'
5
7
  // const BARE_WEBSOCKET_URL = 'http://192.168.1.173:3000'
@@ -138,18 +140,22 @@ export const getPlivoAccessToken = async () => {
138
140
  return result?.accessToken;
139
141
  };
140
142
  export const createSipAccount = async (data) => {
141
- const url = BARE_WEBSOCKET_URL + '/ws/create-sip-account';
142
- const response = await fetch(url, {
143
- method: 'POST',
144
- body: JSON.stringify(data),
145
- headers: {
146
- ['Content-Type']: 'application/json'
143
+ try {
144
+ const url = BARE_WEBSOCKET_URL + '/ws/create-sip-account';
145
+ const response = await fetch(url, {
146
+ method: 'POST',
147
+ body: JSON.stringify(data),
148
+ headers: {
149
+ ['Content-Type']: 'application/json'
150
+ }
151
+ });
152
+ if (!response.ok) {
153
+ throw new Error(`Response status: ${response.status}`);
147
154
  }
148
- });
149
- if (!response.ok) {
150
- throw new Error(`Response status: ${response.status}`);
155
+ const result = await response.json();
156
+ return result;
157
+ }
158
+ catch (e) {
159
+ showError('We’re having trouble connecting the call. Please try again in a moment');
151
160
  }
152
- const result = await response.json();
153
- console.log(result);
154
- return result;
155
161
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phonghq/go-chat",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"