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:
@@ -27,19 +27,21 @@ export default {
|
|||||||
|
|
||||||
// Get inquiries from local storage
|
// Get inquiries from local storage
|
||||||
const myInquiries = state.inquiries
|
const myInquiries = state.inquiries
|
||||||
|
let inquiryIndex
|
||||||
// Set createdAt
|
// Set createdAt
|
||||||
if (newName) {
|
if (newName) {
|
||||||
value.createdAt = new Date()
|
value.createdAt = new Date()
|
||||||
} else {
|
} else {
|
||||||
var inquiryIndex = myInquiries.findIndex(
|
inquiryIndex = myInquiries.findIndex(
|
||||||
oldInquiry => oldInquiry.id === inquiryTab.id
|
oldInquiry => oldInquiry.id === inquiryTab.id
|
||||||
)
|
)
|
||||||
value.createdAt = myInquiries[inquiryIndex].createdAt
|
|
||||||
|
value.createdAt =
|
||||||
|
inquiryIndex !== -1 ? myInquiries[inquiryIndex].createdAt : new Date()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert in inquiries list
|
// Insert in inquiries list
|
||||||
if (newName) {
|
if (newName || inquiryIndex === -1) {
|
||||||
myInquiries.push(value)
|
myInquiries.push(value)
|
||||||
} else {
|
} else {
|
||||||
myInquiries.splice(inquiryIndex, 1, value)
|
myInquiries.splice(inquiryIndex, 1, value)
|
||||||
|
|||||||
@@ -164,7 +164,10 @@ export default {
|
|||||||
inquiry => inquiry.id === this.currentInquiryTab.id
|
inquiry => inquiry.id === this.currentInquiryTab.id
|
||||||
)
|
)
|
||||||
|
|
||||||
if (inquiryInStore?.updatedAt !== this.currentInquiryTab?.updatedAt) {
|
if (
|
||||||
|
inquiryInStore &&
|
||||||
|
inquiryInStore.updatedAt !== this.currentInquiryTab.updatedAt
|
||||||
|
) {
|
||||||
this.$modal.show('inquiry-conflict')
|
this.$modal.show('inquiry-conflict')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user