Skip to content

Commit

Permalink
[Issue ViewTube#2487] Use messagesStore instead raw JS alert
Browse files Browse the repository at this point in the history
  • Loading branch information
chonsser committed Feb 1, 2024
1 parent 9ca716d commit aaf435a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/components/watch/ShareOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import QrPopUp from '@/components/popup/QrPopUp.vue';
import ShareOptionEntry from '@/components/list/ShareOptionEntry.vue';
import { useVideoPlayerStore } from '@/store/videoPlayer';
import { useMessagesStore } from '@/store/messages';
export default defineComponent({
name: 'ShareOptions',
Expand All @@ -49,6 +50,7 @@ export default defineComponent({
}
},
setup(props) {
const messagesStore = useMessagesStore();
const qrPopUpOpen = ref(false);
const videoPlayerStore = useVideoPlayerStore();
Expand All @@ -65,7 +67,12 @@ export default defineComponent({
};
const writeToClipboard = (text: string) => {
if (!navigator.clipboard) {
alert('Unable to copy (running ViewTube on non-https website).');
messagesStore.createMessage({
title: 'Unable to copy',
message: 'Running ViewTube on non-https website.',
type: 'error',
dismissDelay: 3000
});
return;
}
navigator.clipboard.writeText(text);
Expand Down

0 comments on commit aaf435a

Please sign in to comment.