mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 10:08:52 +08:00
#31 fix deleting inquiry
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user