FIX: remove '/' from host in client-control(#1156)

This commit is contained in:
Alex Christoffer Rasmussen
2024-07-30 12:36:31 +02:00
committed by GitHub
parent e500fa6b5e
commit ce8b0d9850
3 changed files with 4 additions and 5 deletions
@@ -38,7 +38,7 @@ export function RedirectClientModal(props: RedirectClientModalProps) {
onClose(); onClose();
}; };
const host = `${window.location.origin}/`; const host = window.location.origin;
const canSubmit = path !== currentPath && path !== ''; const canSubmit = path !== currentPath && path !== '';
return ( return (
@@ -12,9 +12,7 @@ export const useClientPath = () => {
// notify of client path changes // notify of client path changes
useEffect(() => { useEffect(() => {
//remove leading '/' from path socketSendJson('set-client-path', pathname + search);
const fullPath = (pathname.startsWith('/') ? pathname.slice(1) : pathname) + search;
socketSendJson('set-client-path', fullPath);
}, [pathname, search]); }, [pathname, search]);
// navigate to new path when received from server // navigate to new path when received from server
+2 -1
View File
@@ -36,7 +36,8 @@ export const connectSocket = () => {
} }
socketSendJson('set-client-type', 'ontime'); socketSendJson('set-client-type', 'ontime');
socketSendJson('set-client-path', location.pathname);
socketSendJson('set-client-path', location.pathname + location.search);
}; };
websocket.onclose = () => { websocket.onclose = () => {