feat(#280): remember image search device
This commit is contained in:
@@ -471,7 +471,7 @@ export default {
|
||||
emptyImageSearchBatch() { return { open: false, saving: false, step: 'confirm', rows: [], options: { rules: [], devices: [] }, ruleId: null, deviceId: null, overwriteLinked: false, results: [], successCount: 0, failureCount: 0, skippedCount: 0 } },
|
||||
async openImageSearchBatch() {
|
||||
if (!this.imageSearchRows.length) return
|
||||
this.imageSearchBatch = { ...this.emptyImageSearchBatch(), open: true, rows: [...this.imageSearchRows] }
|
||||
this.imageSearchBatch = { ...this.emptyImageSearchBatch(), open: true, rows: [...this.imageSearchRows], deviceId: readPurchaseDevice(this.$store.getters.userId) }
|
||||
const [rules, devices] = await Promise.all([listCollectionRules({ page: 1, pageSize: 100 }), listDevices({ page: 1, pageSize: 100 })])
|
||||
this.imageSearchBatch.options = { rules: rules.data.items || [], devices: devices.data.items || [] }
|
||||
},
|
||||
@@ -480,6 +480,7 @@ export default {
|
||||
if (this.imageSearchBatch.saving || !this.imageSearchBatch.ruleId) return
|
||||
this.imageSearchBatch.saving = true
|
||||
try {
|
||||
if (this.imageSearchBatch.deviceId) rememberPurchaseDevice(this.$store.getters.userId, this.imageSearchBatch.deviceId)
|
||||
const response = await batchCreateImageSearchCollectionTasks({ requestId: createRequestId(), sybProductIds: this.imageSearchBatch.rows.map(row => row.id), ruleId: this.imageSearchBatch.ruleId, deviceId: this.imageSearchBatch.deviceId || null, overwriteLinked: this.imageSearchBatch.overwriteLinked })
|
||||
this.imageSearchBatch.results = response.data.items || []
|
||||
this.imageSearchBatch.successCount = response.data.successCount || 0
|
||||
|
||||
Reference in New Issue
Block a user