Add user API token with copy to clipboard

This commit is contained in:
advplyr 2022-03-17 09:28:31 -05:00
parent 08e648a3bc
commit 1dde02b170
2 changed files with 26 additions and 0 deletions

View file

@ -125,6 +125,23 @@ Vue.prototype.$sanitizeFilename = (input, replacement = '') => {
return sanitized
}
Vue.prototype.$copyToClipboard = (str, ctx) => {
return new Promise((resolve) => {
if (!navigator.clipboard) {
console.warn('Clipboard not supported')
return resolve(false)
}
navigator.clipboard.writeText(str).then(() => {
console.log('Clipboard copy success', str)
ctx.$toast.success('Copied to clipboard')
resolve(true)
}, (err) => {
console.error('Clipboard copy failed', str, err)
resolve(false)
})
})
}
function xmlToJson(xml) {
const json = {};