Update endpoints and URL bases configuration
This commit is contained in:
@@ -28,9 +28,12 @@ import { watchEffect, ref } from 'vue'
|
||||
import Router from '@/router/index';
|
||||
import { url_document_get } from '@/repositories/Document';
|
||||
|
||||
const dataURL = ref('')
|
||||
const dataURL = ref<string>('')
|
||||
watchEffect(()=>{
|
||||
dataURL.value = url_document_get + Router.currentRoute.value.path
|
||||
dataURL.value = new URL(
|
||||
url_document_get + Router.currentRoute.value.path,
|
||||
location.origin.replace( /^http/, 'ws')
|
||||
).toString();
|
||||
})
|
||||
const emit = defineEmits({
|
||||
visibleImg(value: boolean){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from 'axios'
|
||||
|
||||
/* Base domain for all request */
|
||||
export const baseURL = import.meta.env.VITE_URL_DOCUMENT_GET
|
||||
export const baseURL = import.meta.env.VITE_URL_DOCUMENT
|
||||
|
||||
/* Config Client*/
|
||||
const Client = axios.create({
|
||||
|
||||
@@ -24,9 +24,9 @@ export type FileDocument = BaseDocument & {
|
||||
export type Document = FolderDocument | FileDocument;
|
||||
|
||||
|
||||
export const url_document_watch_ws = import.meta.env.VITE_URL_DOCUMENT_WATCH_WS
|
||||
export const url_document_upload_ws = import.meta.env.VITE_URL_DOCUMENT_UPLOAD_WS
|
||||
export const url_document_get = import.meta.env.VITE_URL_DOCUMENT_GET
|
||||
export const url_document_watch_ws = '/api/watch'
|
||||
export const url_document_upload_ws = '/api/upload'
|
||||
export const url_document_get ='/files'
|
||||
|
||||
export class DocumentHandler {
|
||||
constructor( private store: DocumentStore = useDocumentStore() ) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function createWebSocket(url: string, eventHandler: (event: MessageEvent) => void) {
|
||||
const urlObject = new URL(url);
|
||||
const urlObject = new URL(url, location.origin.replace( /^http/, 'ws'));
|
||||
const webSocket = new WebSocket(urlObject);
|
||||
webSocket.onmessage = eventHandler;
|
||||
return webSocket;
|
||||
|
||||
Reference in New Issue
Block a user