Skip to content

A self-hosted media server and file management system

clipboard error

aminnausinc209b69ec567
diff --git a/resources/js/composables/useClipboard.js b/resources/js/composables/useClipboard.js
index b855748d..4ba1d28f 100644
--- a/resources/js/composables/useClipboard.js
+++ b/resources/js/composables/useClipboard.js
@@ -1,16 +1,24 @@
import { reactive } from "vue";
+import { useToast } from '../composables/useToast';
export default function useClipboard(copyText) {
+
+ const toast = useToast();
return reactive({
copyText,
copyNotification: false,
copyToClipboard() {
- navigator.clipboard.writeText(this.copyText);
- this.copyNotification = true;
- let that = this;
- setTimeout(function () {
- that.copyNotification = false;
- }, 3000);
+ try {
+ navigator.clipboard.writeText(this.copyText);
+ this.copyNotification = true;
+ let that = this;
+ setTimeout(function () {
+ that.copyNotification = false;
+ }, 3000);
+ } catch (error) {
+ console.log(error);
+ toast.add({ type: 'danger', title:'Error', description:'Unable to copy. Network is not secure.', life: 3000});
+ }
}
});
}
\ No newline at end of file