import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';

export function useClipboard() {
    const quasar = useQuasar();
    const { t } = useI18n();
    /**
     *
     * @param {String} value Value to send to clipboardAPI
     * @param {Object} {label, component} Refer to Quasar notify configuration. Label is the text to translate
     */
    function copyText(value, { label = 'components.VnLv.copyText', component = {} }) {
        navigator.clipboard.writeText(value);
        quasar.notify({ type: 'positive', message: t(label, component) });
    }
    return { copyText };
}
