Rewrite login and register related queries using React Query
Change-Id: Ifb462a30b3100043b29aaa3db7c321950937cad1
diff --git a/client/src/utils/utils.ts b/client/src/utils/utils.ts
index 53b8a02..d432c56 100644
--- a/client/src/utils/utils.ts
+++ b/client/src/utils/utils.ts
@@ -45,3 +45,13 @@
};
export type Listener = () => void;
+
+export function debounce<T extends any[]>(fn: (...args: T) => void, timeout = 1000) {
+ let timeoutId: ReturnType<typeof setTimeout>;
+ return (...args: T) => {
+ clearTimeout(timeoutId);
+ timeoutId = setTimeout(() => {
+ fn(...args);
+ }, timeout);
+ };
+}