diff --git a/app/javascript/shared/helpers/clipboard.js b/app/javascript/shared/helpers/clipboard.js index dbadd4037..3749ab11e 100644 --- a/app/javascript/shared/helpers/clipboard.js +++ b/app/javascript/shared/helpers/clipboard.js @@ -5,10 +5,17 @@ * @param {string} text text to be written to the clipboard * @throws {Error} unable to copy text to clipboard */ +import { emitter } from 'shared/helpers/mitt'; + export const copyTextToClipboard = async text => { try { await navigator.clipboard.writeText(text); } catch (error) { + // TODO: show localized error message + emitter.emit( + 'newToastMessage', + 'Network Error: Unable to copy text to clipboard.' + ); throw new Error(`Unable to copy text to clipboard: ${error.message}`); } };