1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-07 02:28:54 +08:00

small refactor

This commit is contained in:
lana-k
2020-11-25 22:04:11 +01:00
parent 3b43fcddb4
commit a1a330986d
3 changed files with 40 additions and 28 deletions

View File

@@ -23,7 +23,13 @@ export default {
name: 'DbUpload',
methods: {
loadDb () {
this.$db.loadDb(this.$refs.file.files[0])
return this.$db.loadDb(this.$refs.file.files[0])
.then((schema) => {
this.$store.commit('saveSchema', schema)
if (this.$route.path !== '/editor') {
this.$router.push('/editor')
}
})
},
dragover (event) {
event.preventDefault()
@@ -42,9 +48,11 @@ export default {
event.preventDefault()
this.$refs.file.files = event.dataTransfer.files
this.loadDb()
// Clean up
event.currentTarget.classList.add('bg-gray-100')
event.currentTarget.classList.remove('bg-green-300')
.then(() => {
// Clean up
event.currentTarget.classList.add('bg-gray-100')
event.currentTarget.classList.remove('bg-green-300')
})
}
}
}

View File

@@ -76,6 +76,9 @@ export default {
methods: {
changeDb () {
this.$db.loadDb(this.$refs.dbfile.files[0])
.then((schema) => {
this.$store.commit('saveSchema', schema)
})
}
}
}