more work on attachments

* fix frontend env usage
This commit is contained in:
Philipinho
2024-05-22 23:24:57 +01:00
parent b06a78b6ec
commit ccf9d5d99f
31 changed files with 612 additions and 349 deletions

View File

@ -1,24 +1,7 @@
import { getCollaborationUrl } from "@/lib/config.ts";
const useCollaborationURL = (): string => {
const PATH = "/collab";
// TODO: revisit
/*
if (import.meta.env.VITE_COLLABORATION_URL) {
return import.meta.env.VITE_COLLABORATION_URL + PATH;
}
const API_URL = import.meta.env.VITE_BACKEND_API_URL;
if (!API_URL) {
throw new Error("Backend API URL is not defined");
}
*/
const API_URL = import.meta.env.DEV
? "http://localhost:3000"
: window.location.protocol + "//" + window.location.host;
const wsProtocol = API_URL.startsWith("https") ? "wss" : "ws";
return `${wsProtocol}://${API_URL.split("://")[1]}${PATH}`;
return getCollaborationUrl();
};
export default useCollaborationURL;