diff --git a/src/api/support/api.support.ts b/src/api/support/api.support.ts index 68025dd..eb10a0b 100644 --- a/src/api/support/api.support.ts +++ b/src/api/support/api.support.ts @@ -1,19 +1,25 @@ -import env from "../index" +import env from "../index"; -const support = `${env.API_URL_SUPPORT}` +const support = `${env.API_URL_SUPPORT}`; export default { - supportMessageStatus: (id: string) => `${support}/issue/${id}/message-status`, + supportMessageStatus: (id: string) => `${support}/issue/${id}/message-status`, - supportMessage: (id: string, pageSize: number = 999, page: number = 1) => `${support}/issue/${id}/message?pageSize=${pageSize}&page=${page}`, + supportMessage: (id: string, pageSize: number = 999, page: number = 1) => + `${support}/issue/${id}/message?pageSize=${pageSize}&page=${page}`, - supportIssueUserId: (userId: string) => `${support}/issue?userId=${userId}`, + supportIssueUserId: (userId: string) => `${support}/issue?userId=${userId}`, - supportIssue: (pageSize: number = 999, page: number = 1) => `${support}/issue?pageSize=${pageSize}&page=${page}`, + supportIssue: (pageSize: number = 999, page: number = 1) => + `${support}/issue?pageSize=${pageSize}&page=${page}`, - supportSearchIssue: (search: string, pageSize: number = 999, page: number = 1) => `${support}/issue?pageSize=${pageSize}&page=${page}&search=${search}`, + supportSearchIssue: ( + search: string, + pageSize: number = 999, + page: number = 1 + ) => `${support}/issue?pageSize=${pageSize}&page=${page}&search=${search}`, - supportIssueCategory: `${support}/issue-category`, - supportNewIssue: `${support}/issue`, - supportSocket: `${support}`, -} + supportIssueCategory: `${support}/issue-category`, + supportNewIssue: `${support}/issue`, + supportSocket: `${new URL(support).origin}`, +}; diff --git a/src/modules/00_support/components/ChatMessage.vue b/src/modules/00_support/components/ChatMessage.vue index d415a54..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; diff --git a/src/modules/00_support/components/FormChat.vue b/src/modules/00_support/components/FormChat.vue index faef73f..b2a698d 100644 --- a/src/modules/00_support/components/FormChat.vue +++ b/src/modules/00_support/components/FormChat.vue @@ -2,10 +2,12 @@ import { ref } from "vue"; import { storeToRefs } from "pinia"; import { useSupportStore } from "@/modules/00_support/store/Main"; +import { useCounterMixin } from "@/stores/mixin"; import ChatMessage from "@/modules/00_support/components/ChatMessage.vue"; const store = useSupportStore(); const content = ref(""); +const { date2Thai } = useCounterMixin(); const { scrollContainer } = storeToRefs(store); function getOnlineStatus(option: "icon" | "status") { @@ -13,6 +15,11 @@ function getOnlineStatus(option: "icon" | "status") { if (option === "icon") return isAdmin ? "green" : "grey"; if (option === "status") return isAdmin ? "ออนไลน์" : "ออฟไลน์"; } + +const thaiOptions: Intl.DateTimeFormatOptions = { + hour: "2-digit", + minute: "2-digit", +};