Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inventory-promotion-react
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
inventory-promotion-react
Commits
bf59eb91
Commit
bf59eb91
authored
May 12, 2021
by
Ben Anderson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'AFP-15' into dev
parents
b3fda0f1
ec28b423
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
SearchResults.jsx
src/component/SearchResults.jsx
+18
-4
No files found.
src/component/SearchResults.jsx
View file @
bf59eb91
import
React
from
"react"
;
import
ProductRow
from
"./ProductRow.jsx"
;
import
{
Table
}
from
"react-bootstrap"
;
// import "./../styles/ProductTable.css";
export
default
class
SearchResults
extends
React
.
Component
{
import
{
deleteProduct
}
from
"../actions/apiRequests"
;
import
{
withRouter
}
from
"react-router"
;
class
SearchResults
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
results
:
this
.
props
.
history
.
location
.
state
.
results
}
this
.
handleDelete
=
this
.
handleDelete
.
bind
(
this
);
}
handleDelete
(
sku
){
deleteProduct
(
sku
)
.
then
(()
=>
{
const
newResults
=
this
.
state
.
results
.
filter
(
product
=>
product
.
sku
!==
sku
);
this
.
setState
({
results
:
newResults
});
this
.
props
.
history
.
push
(
"/searchResults"
,
this
.
state
);
});
}
render
()
{
...
...
@@ -31,7 +43,7 @@ export default class SearchResults extends React.Component {
<
tbody
>
{
this
.
state
.
results
.
map
((
product
)
=>
{
return
(
<
ProductRow
key=
{
product
.
sku
}
product=
{
product
}
/>
<
ProductRow
key=
{
product
.
sku
}
product=
{
product
}
handleDelete=
{
()
=>
this
.
handleDelete
(
product
.
sku
)
}
/>
);
})
}
</
tbody
>
...
...
@@ -43,4 +55,6 @@ export default class SearchResults extends React.Component {
);
}
}
\ No newline at end of file
}
export
default
withRouter
(
SearchResults
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment