Skip to content

Commit b052912

Browse files
Code: unused code removed and improvements done
1 parent fd3ca8a commit b052912

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

components/csvbox/csvbox-new-row/csvbox-new-row.mjs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@ export default {
3131
});
3232

3333
const { webhookId, sample_response } = data;
34-
const hookId = webhookId;
35-
this._setHookID(hookId);
34+
this._setHookID(webhookId);
3635

3736
if (!Array.isArray(sample_response) || sample_response.length === 0) {
3837
throw new Error("Unable to fetch sample data from selected sheet.");
3938
}
4039

4140
const first = sample_response[0];
4241
this.$emit({
43-
import_id: `sample_${Date.now()}`,
42+
import_id: `sample_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
4443
sheet_id: this.sheetId,
4544
sheet_name: first.sheet_name || "Sample Data",
4645
row_number: first.row_number || 1,
@@ -51,7 +50,7 @@ export default {
5150
import_description: first.import_description || "This is a sample test import",
5251
original_filename: first.original_filename || "product_details.csv",
5352
}, {
54-
id: `sample_${Date.now()}`,
53+
id: `sample_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
5554
summary: `Sample data loaded from sheet - ${first.sheet_name} `,
5655
ts: Date.now(),
5756
});
@@ -73,8 +72,8 @@ export default {
7372
sheet_slug: this.sheetId,
7473
},
7574
});
76-
this.db.set("hookId", null);
77-
this.db.set("sampleRow", null);
75+
this._setHookID(null);
76+
this._setSampleRow(null);
7877
}
7978
} catch (err) {
8079
console.error("Deactivation Error:", err);
@@ -119,7 +118,7 @@ export default {
119118

120119
for (const row of body) {
121120
this.$emit(row, {
122-
id: row.import_id || `${row.sheet_id}_${Date.now()}`,
121+
id: row.import_id || `${row.sheet_id}_${row.row_number}_${Date.now()}`,
123122
summary: `New data imported to sheet ${row.sheet_name}`,
124123
ts: Date.now(),
125124
});

components/csvbox/csvbox.app.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default {
4444
const config = {
4545
url: this._getUrl(path),
4646
headers: this._getHeaders(headers),
47-
auth: this._getAuthKeys(),
4847
returnFullResponse: true,
4948
...otherConfig,
5049
};

0 commit comments

Comments
 (0)