ต่อ socket กับserver

This commit is contained in:
Kittapath 2024-02-16 14:31:05 +07:00 committed by puri-ph4tt
parent 940c2c4592
commit fc369de729
4 changed files with 317 additions and 277 deletions

View file

@ -1,53 +1,44 @@
/**config api */
import { ref } from "vue";
import { ref } from "vue"
const env = ref<string>(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<string>(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<any>({
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<string>(config.value[env.value].API_URI);
const API_URL_SUPPORT = ref<string>(config.value[env.value].API_URL_SUPPORT);
const API_SUPPORT_SOCKET = ref<string>(
config.value[env.value].API_SUPPORT_SOCKET
);
const MEET_URI = ref<string>(config.value[env.value].MEET_URI);
const LINK_EVALUATE_PUBLISH = ref<string>(
config.value[env.value].LINK_EVALUATE_PUBLISH
);
const API_URI = ref<string>(config.value[env.value].API_URI)
const API_URL_SUPPORT = ref<string>(config.value[env.value].API_URL_SUPPORT)
const MEET_URI = ref<string>(config.value[env.value].MEET_URI)
const LINK_EVALUATE_PUBLISH = ref<string>(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,
}

View file

@ -1,26 +1,19 @@
import env from "../index";
import env from "../index"
const support = `${env.API_URL_SUPPORT}`;
const socket = `${env.API_SUPPORT_SOCKET}`;
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: `${socket}`,
};
supportIssueCategory: `${support}/issue-category`,
supportNewIssue: `${support}/issue`,
supportSocket: `${support}`,
}