function useCopyToClipboard() {
  const copy = async (text: any) => {
    if (navigator.clipboard) {
      try {
        await navigator.clipboard.writeText(text);
      } catch (err) {
        console.log('Failed to copy text: ', err);
      }
    } else {
      console.log('Clipboard API is not supported');
    }
  };

  return copy;
}

export default useCopyToClipboard;
