summaryrefslogtreecommitdiff
path: root/client/faceSearch
diff options
context:
space:
mode:
Diffstat (limited to 'client/faceSearch')
-rw-r--r--client/faceSearch/faceSearch.actions.js10
-rw-r--r--client/faceSearch/faceSearch.container.js17
-rw-r--r--client/faceSearch/faceSearch.query.js3
3 files changed, 12 insertions, 18 deletions
diff --git a/client/faceSearch/faceSearch.actions.js b/client/faceSearch/faceSearch.actions.js
index ccd51201..224977b5 100644
--- a/client/faceSearch/faceSearch.actions.js
+++ b/client/faceSearch/faceSearch.actions.js
@@ -40,16 +40,16 @@ export const updateOptions = opt => dispatch => {
// API functions
-export const upload = (file, query) => dispatch => {
+export const upload = (payload, file) => dispatch => {
// const { options } = store.getState().faceSearch
const tag = 'result'
const fd = new FormData()
fd.append('query_img', file)
// fd.append('limit', options.perPage)
- if (!query) {
- dispatch(loading(tag))
- }
- post(url.upload(), fd)
+ // if (!query) {
+ dispatch(loading(tag))
+ // }
+ post(url.upload(payload.dataset), fd)
.then(data => {
dispatch(loaded(tag, data))
})
diff --git a/client/faceSearch/faceSearch.container.js b/client/faceSearch/faceSearch.container.js
index e5fae24b..f96961db 100644
--- a/client/faceSearch/faceSearch.container.js
+++ b/client/faceSearch/faceSearch.container.js
@@ -9,23 +9,16 @@ import FaceSearchResult from './faceSearch.result'
class FaceSearchContainer extends Component {
render() {
+ const { payload } = this.props
+ console.log(payload)
return (
<div className='searchContainer'>
- <FaceSearchQuery />
- <FaceSearchResult />
+ <FaceSearchQuery payload={payload} />
+ <FaceSearchResult payload={payload} />
</div>
)
}
}
-const mapStateToProps = state => ({
- query: state.faceSearch.query,
- result: state.faceSearch.result,
- options: state.faceSearch.options,
-})
-const mapDispatchToProps = dispatch => ({
- actions: bindActionCreators({ ...actions }, dispatch),
-})
-
-export default connect(mapStateToProps, mapDispatchToProps)(FaceSearchContainer)
+export default FaceSearchContainer
diff --git a/client/faceSearch/faceSearch.query.js b/client/faceSearch/faceSearch.query.js
index 9313c538..1261269d 100644
--- a/client/faceSearch/faceSearch.query.js
+++ b/client/faceSearch/faceSearch.query.js
@@ -6,6 +6,7 @@ import * as actions from './faceSearch.actions'
class FaceSearchQuery extends Component {
upload(e) {
+ const { payload } = this.props
const files = e.dataTransfer ? e.dataTransfer.files : e.target.files
let i
let file
@@ -14,7 +15,7 @@ class FaceSearchQuery extends Component {
if (file && file.type.match('image.*')) break
}
if (!file) return
- this.props.actions.upload(file)
+ this.props.actions.upload(this.props.payload, file)
}
render() {