1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 18:18:53 +08:00

#31 fix deleting inquiry

This commit is contained in:
lana-k
2025-09-29 21:17:36 +02:00
parent be6a19a30f
commit d3fbf08569
2 changed files with 10 additions and 5 deletions

View File

@@ -27,19 +27,21 @@ export default {
// Get inquiries from local storage
const myInquiries = state.inquiries
let inquiryIndex
// Set createdAt
if (newName) {
value.createdAt = new Date()
} else {
var inquiryIndex = myInquiries.findIndex(
inquiryIndex = myInquiries.findIndex(
oldInquiry => oldInquiry.id === inquiryTab.id
)
value.createdAt = myInquiries[inquiryIndex].createdAt
value.createdAt =
inquiryIndex !== -1 ? myInquiries[inquiryIndex].createdAt : new Date()
}
// Insert in inquiries list
if (newName) {
if (newName || inquiryIndex === -1) {
myInquiries.push(value)
} else {
myInquiries.splice(inquiryIndex, 1, value)

View File

@@ -164,7 +164,10 @@ export default {
inquiry => inquiry.id === this.currentInquiryTab.id
)
if (inquiryInStore?.updatedAt !== this.currentInquiryTab?.updatedAt) {
if (
inquiryInStore &&
inquiryInStore.updatedAt !== this.currentInquiryTab.updatedAt
) {
this.$modal.show('inquiry-conflict')
return
}