Fix Upload and remove last part of button animation.

pull/144/head
Henrique Dias 2017-07-04 18:08:42 +01:00
parent f9699f174d
commit 973d4380df
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
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 {