aboutsummaryrefslogtreecommitdiffstats
path: root/apps/Notes/helpers/copyToClipboard.js
blob: 4ec1b393880827bcee1a222ccdf8950e818e32aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const copyToClipboard = (text, t, setPopup) => {
  navigator
    .clipboard.writeText(text)
    .then(() => {
      setPopup({
        content: t('notes_copy_success'),
        time: 2000
      })
    })
    .catch(() => {
      setPopup({
        content: t('notes_copy_error'),
        time: 2000,
        error: true
      })
    })
}

export default copyToClipboard