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

Always create empty db on start #46

This commit is contained in:
lana-k
2021-05-24 21:45:51 +02:00
parent 179ff8b1e1
commit ac89259924
2 changed files with 16 additions and 10 deletions

View File

@@ -4,6 +4,8 @@ import Editor from '@/views/Main/Editor'
import MyQueries from '@/views/Main/MyQueries'
import Welcome from '@/views/Welcome'
import Main from '@/views/Main'
import store from '@/store'
import database from '@/lib/database'
Vue.use(VueRouter)
@@ -36,4 +38,13 @@ const router = new VueRouter({
routes
})
router.beforeEach(async (to, from, next) => {
if (!store.state.db) {
const newDb = database.getNewDatabase()
await newDb.loadDb()
store.commit('setDb', newDb)
}
next()
})
export default router