Skip to content

Commit 56b16c1

Browse files
author
JasmeetLuthra
committed
handling product,user change for null values, fixed created by in list view
1 parent e2aebc6 commit 56b16c1

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

components/BuyLinksView/BuyLinkFilterForm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ class BuyLinkFilterForm extends React.Component {
126126

127127
handleProductChange = async (event, value) => {
128128
let newFilterParams = this.state.filterParams;
129-
newFilterParams['product_id'] = value.id
129+
newFilterParams['product_id'] = value ? value.id : ''
130130
this.setState(prevState => ({
131131
filterParams: newFilterParams
132132
}));
133133
}
134134

135135
handleUserChange = async (event, value) => {
136136
let newFilterParams = this.state.filterParams;
137-
newFilterParams['user_id'] = value.id
137+
newFilterParams['user_id'] = value ? value.id : ''
138138
this.setState(prevState => ({
139139
filterParams: newFilterParams
140140
}));

components/BuyLinksView/BuyLinksTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class BuyLinksTable extends React.Component {
159159
{buyLink.use_credits ? 'Applicable' : 'Not Applicable'}
160160
</TableCell>
161161
<TableCell align="center">
162-
{buyLink.created_by}
162+
{buyLink.buyLink_creator.firstname} {buyLink.buyLink_creator.lastname}
163163
</TableCell>
164164

165165
</TableRow>

controllers/buyLink.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ const handleAddBuyLink = (data) => {
1010
}
1111

1212
const searchBuyLinks = (queryParams, pagination) => {
13+
14+
if (!queryParams.product_id)
15+
delete queryParams.product_id
16+
17+
if (!queryParams.user_id)
18+
delete queryParams.user_id
19+
1320
let query = querystring.stringify(queryParams);
1421
return axios.get(`/api/v2/admin/buy_links?page=` + pagination.currentPage + `&limit=` + pagination.rowsPerPage + `&` +query)
1522
}

0 commit comments

Comments
 (0)