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

refactor import method

This commit is contained in:
lana-k
2021-01-06 19:57:02 +01:00
parent 8d083a93c4
commit 78e803b95d
3 changed files with 88 additions and 46 deletions

View File

@@ -72,9 +72,10 @@ export const mutations = {
}
export const actions = {
async addTab ({ state }, tab) {
// If no tab then create a new blank one...
if (!tab) {
async addTab ({ state }, data) {
let tab
// If no data then create a new blank one...
if (!data) {
tab = {
id: nanoid(),
name: null,
@@ -83,6 +84,9 @@ export const actions = {
: 'Untitled',
isUnsaved: true
}
} else {
tab = JSON.parse(JSON.stringify(data))
tab.isUnsaved = false
}
// add new tab only if was not already opened