Skip to content

Commit

Permalink
ebrunun istekleri bitmiyor
Browse files Browse the repository at this point in the history
  • Loading branch information
cagri committed Dec 1, 2019
1 parent a866075 commit 81a7278
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/skyz/rest/elastic_query.py
Expand Up @@ -22,7 +22,7 @@ class ElasticSearch(APIView):
}

def post(self, request):
category = self.post_to_elastic(self.request.data['context'])
category = self.post_to_elastic(self.request.query_params['context'])
return Response(category)

def post_to_elastic(self, like):
Expand Down
8 changes: 8 additions & 0 deletions backend/skyz/settings.py
Expand Up @@ -72,7 +72,15 @@
]

WSGI_APPLICATION = 'skyz.wsgi.application'

CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_WHITELIST = [
'http://localhost:3000',
]
CORS_ORIGIN_REGEX_WHITELIST = [
'http://localhost:3000',
]

# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
Expand Down
Binary file modified backend/token.pickle
Binary file not shown.
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions ui/src/components/pages/FindCategory/FindCategory.js
Expand Up @@ -3,6 +3,7 @@ import { Input } from 'antd';
import { Row, Col } from 'antd';
import Naive from '../../../img/naive.jpg';
import Elastic from '../../../img/elasticsearch.png'
import axios from "axios"

const { Search } = Input;

Expand All @@ -12,13 +13,25 @@ class FindCategory extends React.Component {
this.state = {
category: ''
}
}
componentDidMount = () => {
console.log("zıkkımm")
axios.post(`http://127.0.0.1:8000/api/elasticsearch?context=yeni çıkan telefonlar 4 kamerası ile self çekmek mükü`, {headers: {"Access-Control-Allow-Origin": "*", "Content-Type":"application/json","Access-Control-Allow-Headers": "Origin, X-Requested-With", "Content-Type": "Accept"}})
.then(res => {
console.log("iresponse", res)
})




}
searchCategory = (value) => {
this.setState({
category: value
})
}
render() {
console.log("render")
return (
<>
<div className="name-wrapper">
Expand Down

0 comments on commit 81a7278

Please sign in to comment.