Fix Upload and remove last part of button animation.

Former-commit-id: 3f427b6f34b0a9498c883a15fce396c14640f8f0 [formerly 514a1adf5ff43ba73bb9b13c59d4089b3a72c639] [formerly f0ebafb4fc9b6067ec6c95c881b2652dd2df00f8 [formerly 973d4380df]]
Former-commit-id: 02698fd8f45ce1b5c8d9b3b21bc85ccd42e63b11 [formerly 5eb200cf02ae14d57e14e024ee798fe5dad87a3c]
Former-commit-id: 835d7ed9789dc51311f0c943f3f8f7f01398e26d
This commit is contained in:
Henrique Dias 2017-07-04 18:08:42 +01:00
parent 4e5b309bf9
commit 4401a128ce
5 changed files with 14 additions and 24 deletions

View File

@ -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)
})

View File

@ -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
})
}
}

View File

@ -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)
})
},

View File

@ -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)
})
}

View File

@ -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 {