25 lines
594 B
TypeScript
25 lines
594 B
TypeScript
|
|
/**
|
||
|
|
* Hook to check if user is currently rate limited
|
||
|
|
* Action 5.4.1.4: Disable buttons when rate limited
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { useRateLimitStore } from '@/stores/rateLimit';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Hook to check if the user is currently rate limited
|
||
|
|
*
|
||
|
|
* @returns {boolean} True if user is rate limited, false otherwise
|
||
|
|
*
|
||
|
|
* @example
|
||
|
|
* ```tsx
|
||
|
|
* const isRateLimited = useIsRateLimited();
|
||
|
|
* <Button disabled={isSubmitting || isRateLimited}>
|
||
|
|
* Submit
|
||
|
|
* </Button>
|
||
|
|
* ```
|
||
|
|
*/
|
||
|
|
export function useIsRateLimited(): boolean {
|
||
|
|
const isLimited = useRateLimitStore((state) => state.isLimited);
|
||
|
|
return isLimited;
|
||
|
|
}
|