mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-30 11:35:22 +02:00
- Introduced an ImpersonationBar component for admin users to impersonate other users, enhancing user management capabilities. - Updated the ProfileForm to include an option for allowing impersonation, with a description for clarity. - Modified the DashboardLayout to conditionally display the impersonation bar based on user roles and cloud settings. - Added database schema changes to support the new impersonation feature, including a new column for allowImpersonation in the user table. - Implemented necessary API updates to handle impersonation actions and user data retrieval.
16 lines
362 B
TypeScript
16 lines
362 B
TypeScript
import { useEffect, useState } from "react";
|
|
|
|
export function useDebounce<T>(value: T, delay?: number): T {
|
|
const [debouncedValue, setDebouncedValue] = useState<T>(value);
|
|
|
|
useEffect(() => {
|
|
const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
|
|
|
|
return () => {
|
|
clearTimeout(timer);
|
|
};
|
|
}, [value, delay]);
|
|
|
|
return debouncedValue;
|
|
}
|