Spaces:
Sleeping
Sleeping
File size: 420 Bytes
c40c75a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// useBaseUrl.ts
import { useState, useEffect } from 'react';
export const useBaseUrl = () => {
const [baseUrl, setBaseUrl] = useState("http://localhost:4000");
useEffect(() => {
if (typeof window !== 'undefined') {
const { protocol, host } = window.location;
setBaseUrl(`${protocol}//${host}`);
}
}, []); // Removed router dependency
return baseUrl;
};
export const defaultPageSize = 25; |