import { useMemo } from 'react';

export const useSecureFileUrl = (url: string) => {
  return useMemo(() => {
    if (!url) return url;

    const isSecureUrl = url.startsWith('https://secure-files');
    if (isSecureUrl) {
      return {
        url,
        withCredentials: true,
        crossOrigin: 'use-credentials',
      };
    }
    return url;
  }, [url]);
};
