File size: 503 Bytes
1e8ff3b
8106674
f7b9ff6
 
 
 
 
76b9248
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
export const apiUrl =
  typeof window === "undefined"
    ? process.env.NEXT_PUBLIC_API_URL
    : process.env.NEXT_PUBLIC_API_URL ||
      `${window.location.protocol === "https:" ? "https" : "http"}://${
        window.location.host
      }`;

export function debounce(func, wait) {
  let timeout;

  return function executedFunction(...args) {
    const later = () => {
      clearTimeout(timeout);
      func(...args);
    };

    clearTimeout(timeout);
    timeout = setTimeout(later, wait);
  };
}