diff --git a/package-lock.json b/package-lock.json index 63387c3..91582e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "moment": "^2.29.4", "pinia": "^2.0.29", "quasar": "^2.11.1", + "socket.io-client": "^4.7.4", "structure-chart": "^0.0.9", "vue": "^3.4.15", "vue-router": "^4.1.6", @@ -1191,6 +1192,11 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", + "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" + }, "node_modules/@tato30/vue-pdf": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/@tato30/vue-pdf/-/vue-pdf-1.6.2.tgz", @@ -2894,7 +2900,6 @@ }, "node_modules/debug": { "version": "4.3.4", - "devOptional": true, "license": "MIT", "dependencies": { "ms": "2.1.2" @@ -3056,6 +3061,26 @@ "once": "^1.4.0" } }, + "node_modules/engine.io-client": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.3.tgz", + "integrity": "sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.11.0", + "xmlhttprequest-ssl": "~2.0.0" + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.2.tgz", + "integrity": "sha512-RcyUFKA93/CXH20l4SoVvzZfrSDMOTUS3bWVpTt2FuFP+XYrL8i8oonHP7WInRyVHXh0n/ORtoeiE1os+8qkSw==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/enquirer": { "version": "2.3.6", "dev": true, @@ -5456,7 +5481,6 @@ }, "node_modules/ms": { "version": "2.1.2", - "devOptional": true, "license": "MIT" }, "node_modules/muggle-string": { @@ -6702,6 +6726,32 @@ "dev": true, "license": "MIT" }, + "node_modules/socket.io-client": { + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.4.tgz", + "integrity": "sha512-wh+OkeF0rAVCrABWQBaEjLfb7DVPotMbu0cgWgyR0v6eA4EoVnAwcIeIbcdTE3GT/H3kbdLl7OoH2+asoDRIIg==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.2", + "engine.io-client": "~6.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/source-map": { "version": "0.6.1", "dev": true, @@ -7804,7 +7854,6 @@ }, "node_modules/ws": { "version": "8.11.0", - "dev": true, "license": "MIT", "engines": { "node": ">=10.0.0" @@ -7835,6 +7884,14 @@ "dev": true, "license": "MIT" }, + "node_modules/xmlhttprequest-ssl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", + "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/yallist": { "version": "3.1.1", "dev": true, diff --git a/src/api/index.ts b/src/api/index.ts index bd53cbe..f3da588 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,53 +1,44 @@ /**config api */ -import { ref } from "vue"; +import { ref } from "vue" -const env = ref(process.env.NODE_ENV || "development"); -export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG; -export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL; +const env = ref(process.env.NODE_ENV || "development") +export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG +export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL // if (process.env.VUE_APP_TEST) { // env = "test"; // } const config = ref({ - development: { - // API_URI: "https://localhost:7260/api", - API_URI: "https://bma-ehr.frappet.synology.me/api/v1", - API_URL_SUPPORT: "http://192.168.1.10:3000/api/v1/support", - API_SUPPORT_SOCKET: "http://192.168.1.10:3000/", - MEET_URI: "meet.frappet.com", - LINK_EVALUATE_PUBLISH: "https://bma-ehr-publish.frappet.synology.me", - }, - test: { - API_URI: "http://localhost:5010/api/v1", - MEET_URI: "meet.frappet.com", - }, - production: { - API_URI: apiUrlConfig, - API_URL_SUPPORT: "http://192.168.1.10:3000/api/v1/support", - API_SUPPORT_SOCKET: "http://192.168.1.10:3000/", - API_URI_ORG_TREE: - "https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230707_115124.json", - MEET_URI: "meet.frappet.com", - LINK_EVALUATE_PUBLISH: apiUrlConfigPublish, - }, -}); + development: { + // API_URI: "https://localhost:7260/api", + API_URI: "https://bma-ehr.frappet.synology.me/api/v1", + API_URL_SUPPORT: "https://bma-ehr.frappet.synology.me/api/v1/support", + MEET_URI: "meet.frappet.com", + LINK_EVALUATE_PUBLISH: "https://bma-ehr-publish.frappet.synology.me", + }, + test: { + API_URI: "http://localhost:5010/api/v1", + MEET_URI: "meet.frappet.com", + }, + production: { + API_URI: apiUrlConfig, + API_URL_SUPPORT: `${apiUrlConfig}/support`, + API_URI_ORG_TREE: "https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230707_115124.json", + MEET_URI: "meet.frappet.com", + LINK_EVALUATE_PUBLISH: apiUrlConfigPublish, + }, +}) -const API_URI = ref(config.value[env.value].API_URI); -const API_URL_SUPPORT = ref(config.value[env.value].API_URL_SUPPORT); -const API_SUPPORT_SOCKET = ref( - config.value[env.value].API_SUPPORT_SOCKET -); -const MEET_URI = ref(config.value[env.value].MEET_URI); -const LINK_EVALUATE_PUBLISH = ref( - config.value[env.value].LINK_EVALUATE_PUBLISH -); +const API_URI = ref(config.value[env.value].API_URI) +const API_URL_SUPPORT = ref(config.value[env.value].API_URL_SUPPORT) +const MEET_URI = ref(config.value[env.value].MEET_URI) +const LINK_EVALUATE_PUBLISH = ref(config.value[env.value].LINK_EVALUATE_PUBLISH) export default { - env: env.value, - config: config.value, - API_URI: API_URI.value, - API_URL_SUPPORT: API_URL_SUPPORT.value, - API_SUPPORT_SOCKET: API_SUPPORT_SOCKET.value, - MEET_URI: MEET_URI.value, - LINK_EVALUATE_PUBLISH: LINK_EVALUATE_PUBLISH.value, -}; + env: env.value, + config: config.value, + API_URI: API_URI.value, + API_URL_SUPPORT: API_URL_SUPPORT.value, + MEET_URI: MEET_URI.value, + LINK_EVALUATE_PUBLISH: LINK_EVALUATE_PUBLISH.value, +} diff --git a/src/api/support/api.support.ts b/src/api/support/api.support.ts index 5e2e63d..eb10a0b 100644 --- a/src/api/support/api.support.ts +++ b/src/api/support/api.support.ts @@ -1,7 +1,6 @@ import env from "../index"; const support = `${env.API_URL_SUPPORT}`; -const socket = `${env.API_SUPPORT_SOCKET}`; export default { supportMessageStatus: (id: string) => `${support}/issue/${id}/message-status`, @@ -22,5 +21,5 @@ export default { supportIssueCategory: `${support}/issue-category`, supportNewIssue: `${support}/issue`, - supportSocket: `${socket}`, + supportSocket: `${new URL(support).origin}`, }; diff --git a/src/modules/00_support/components/ChatMessage.vue b/src/modules/00_support/components/ChatMessage.vue index 3f405ec..6697a63 100644 --- a/src/modules/00_support/components/ChatMessage.vue +++ b/src/modules/00_support/components/ChatMessage.vue @@ -10,7 +10,7 @@ function dateChat(timestamp: string) { const diff = moment().diff(parsedTimestamp); if (diff < 86400000) { - const formattedDate = parsedTimestamp.format("HH:mm:") + " น."; + const formattedDate = parsedTimestamp.format("HH:mm") + " น."; return formattedDate; } else { const beYear = parsedTimestamp.year() + 543; @@ -37,11 +37,14 @@ function dateChat(timestamp: string) { {{ dateChat(item.createdAt) }}