diff --git a/_assets/src/components/Listing.vue b/_assets/src/components/Listing.vue index 5e468e0c..a0a9ddb7 100644 --- a/_assets/src/components/Listing.vue +++ b/_assets/src/components/Listing.vue @@ -173,7 +173,8 @@ export default { this.$store.commit('setReload', true) }) .catch(e => { - buttons.done('upload', false) + buttons.done('upload') + // TODO: show error in box console.log(e) }) diff --git a/_assets/src/components/prompts/Delete.vue b/_assets/src/components/prompts/Delete.vue index 1a6d5658..35a04f8a 100644 --- a/_assets/src/components/prompts/Delete.vue +++ b/_assets/src/components/prompts/Delete.vue @@ -35,7 +35,8 @@ export default { this.$router.push({path: url.removeLastDir(this.$route.path) + '/'}) }) .catch(error => { - buttons.done('delete', false) + buttons.done('delete') + // TODO: show error in prompt console.log(error) }) @@ -61,7 +62,8 @@ export default { .catch(error => { console.log(error) this.$store.commit('setReload', true) - buttons.done('delete', false) + buttons.done('delete') + // TODO: show error in prompt }) } } diff --git a/_assets/src/components/prompts/Move.vue b/_assets/src/components/prompts/Move.vue index 1f19e707..8f5a0f2f 100644 --- a/_assets/src/components/prompts/Move.vue +++ b/_assets/src/components/prompts/Move.vue @@ -20,6 +20,7 @@ import { mapState } from 'vuex' import url from '@/utils/url' import api from '@/utils/api' +import buttons from '@/utils/buttons' export default { name: 'move', @@ -81,7 +82,8 @@ export default { this.$router.push({page: dest}) }) .catch(e => { - buttons.done('move', false) + buttons.done('move') + // TODO: show error in prompt console.log(e) }) }, diff --git a/_assets/src/utils/api.js b/_assets/src/utils/api.js index 735358d2..7185fd36 100644 --- a/_assets/src/utils/api.js +++ b/_assets/src/utils/api.js @@ -57,7 +57,7 @@ function rm (url) { }) } -function put (url) { +function put (url, content = '') { url = removePrefix(url) return new Promise((resolve, reject) => { @@ -74,7 +74,7 @@ function put (url) { } request.onerror = (error) => reject(error) - request.send() + request.send(content) }) } diff --git a/_assets/src/utils/buttons.js b/_assets/src/utils/buttons.js index 46797ac2..2fb366ed 100644 --- a/_assets/src/utils/buttons.js +++ b/_assets/src/utils/buttons.js @@ -26,26 +26,11 @@ function done (button, success = true) { el.style.opacity = 0 - let third = () => { - el.innerHTML = el.dataset.icon - el.style.opacity = null - } - - let second = () => { - el.style.opacity = 0 - setTimeout(third, 200) - } - - let first = () => { + setTimeout(() => { el.classList.remove('spin') - el.innerHTML = success - ? 'done' - : 'close' + el.innerHTML = el.dataset.icon el.style.opacity = 1 - setTimeout(second, 200) - } - - setTimeout(first, 200) + }, 200) } export default {