Skip to content

Commit d622095

Browse files
committed
Refactor parameter handling in eTrusted review actions
- Updated parameter assignments in get-list-of-reviews and get-total-reviews actions to use optional chaining for improved safety and readability. - Simplified the logic for parsing channel, rating, status, type, additional information, and SKU parameters.
1 parent a33a020 commit d622095

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

components/etrusted/actions/get-list-of-reviews/get-list-of-reviews.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,19 @@ export default {
128128
$,
129129
fn: this.etrusted.getListOfReviews,
130130
params: {
131-
channels: this.channelId && parseObject(this.channelId).join(","),
131+
channels: parseObject(this.channelId)?.join(","),
132132
after: this.after,
133133
before: this.before,
134134
submittedAfter: this.submittedAfter,
135135
submittedBefore: this.submittedBefore,
136-
rating: this.rating && parseObject(this.rating).join(","),
137-
status: this.status && parseObject(this.status).join(","),
138-
type: this.type && parseObject(this.type).join(","),
136+
rating: parseObject(this.rating)?.join(","),
137+
status: parseObject(this.status)?.join(","),
138+
type: parseObject(this.type)?.join(","),
139139
hasReply: this.hasReply,
140-
additionalInformation: this.additionalInformation && parseObject(this.additionalInformation).join(","),
140+
additionalInformation: parseObject(this.additionalInformation)?.join(","),
141141
ignoreStatements: this.ignoreStatements,
142142
query: this.query,
143-
sku: this.sku && parseObject(this.sku).join(","),
143+
sku: parseObject(this.sku)?.join(","),
144144
orderBy: this.orderBy,
145145
},
146146
maxResults: this.maxResults,

components/etrusted/actions/get-total-reviews/get-total-reviews.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ export default {
8585
const response = await this.etrusted.getTotalReviews({
8686
$,
8787
params: {
88-
channels: this.channelId && parseObject(this.channelId).join(","),
88+
channels: parseObject(this.channelId)?.join(","),
8989
submittedAfter: this.submittedAfter,
9090
submittedBefore: this.submittedBefore,
91-
rating: this.rating && parseObject(this.rating).join(","),
92-
status: this.status && parseObject(this.status).join(","),
93-
type: this.type && parseObject(this.type).join(","),
91+
rating: parseObject(this.rating)?.join(","),
92+
status: parseObject(this.status)?.join(","),
93+
type: parseObject(this.type)?.join(","),
9494
hasReply: this.hasReply,
9595
ignoreStatements: this.ignoreStatements,
9696
query: this.query,
97-
sku: this.sku && parseObject(this.sku).join(","),
97+
sku: parseObject(this.sku)?.join(","),
9898
},
9999
});
100100

0 commit comments

Comments
 (0)