feat: implement image caching mechanism with configurable cache duration and flush functionality
This commit is contained in:
15
src/hooks/useImageUrl.ts
Normal file
15
src/hooks/useImageUrl.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useImageCache } from "@/contexts/ImageCacheContext";
|
||||
import { useMemo } from "react";
|
||||
|
||||
/**
|
||||
* Hook pour obtenir une URL d'image avec cache busting
|
||||
* Ajoute automatiquement ?v={cacheVersion} à l'URL
|
||||
*/
|
||||
export function useImageUrl(baseUrl: string): string {
|
||||
const { getImageUrl } = useImageCache();
|
||||
|
||||
return useMemo(() => {
|
||||
return getImageUrl(baseUrl);
|
||||
}, [baseUrl, getImageUrl]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user