Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
GCL_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
안형욱
2021-06-12 17:33:45 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4e3c809e26cb0b34ceaffc8fe79e78f38b9ed3a5
4e3c809e
1 parent
0f9a27c1
refact: es search 결과 형식 변경
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
frontend/src/lib/api/elasticsearch.js
frontend/src/lib/api/elasticsearch.js
View file @
4e3c809
import
axios
from
'axios'
;
const
esInstance
=
axios
.
create
({
baseURL
:
process
.
env
.
API_ENDPOINT
,
baseURL
:
process
.
env
.
REACT_APP_
API_ENDPOINT
,
headers
:
{
'Content-Type'
:
'application/json'
,
Authorization
:
`Bearer
${
process
.
env
.
SEARCH_KEY
}
`
,
Authorization
:
`Bearer
${
process
.
env
.
REACT_APP_
SEARCH_KEY
}
`
,
},
});
export
const
search
=
async
searchWord
=>
{
const
res
=
await
esInstance
.
post
(
`/api/as/v1/engines/
${
process
.
env
.
APP_SEARCH_ENGINE_NAME
}
/search`
,
{
query
:
searchWord
,
}
);
export
const
esApi
=
{
search
:
async
searchWord
=>
{
const
res
=
await
esInstance
.
post
(
`/api/as/v1/engines/
${
process
.
env
.
REACT_APP_ENGINE_NAME
}
/search`
,
{
query
:
searchWord
,
}
);
console
.
log
(
res
)
;
return
res
;
return
res
.
data
;
},
};
...
...
Please
register
or
login
to post a comment