Update endpoints and URL bases configuration

This commit is contained in:
Andy-Ruda 2023-10-26 09:06:07 -05:00
parent 754d779069
commit 4bc9cf4534
6 changed files with 14 additions and 11 deletions

View File

@ -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){

View File

@ -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({

View File

@ -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() ) {

View File

@ -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;

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Vite Vasanko</title>
<script type="module" crossorigin src="/assets/index-5620eb6e.js"></script>
<script type="module" crossorigin src="/assets/index-5b9f340c.js"></script>
<link rel="stylesheet" href="/assets/index-fe1bb208.css">
</head>
<body>