Showing
1 changed file
with
7 additions
and
6 deletions
1 | import axios from 'axios'; | 1 | import axios from 'axios'; |
2 | 2 | ||
3 | const esInstance = axios.create({ | 3 | const esInstance = axios.create({ |
4 | - baseURL: process.env.API_ENDPOINT, | 4 | + baseURL: process.env.REACT_APP_API_ENDPOINT, |
5 | headers: { | 5 | headers: { |
6 | 'Content-Type': 'application/json', | 6 | 'Content-Type': 'application/json', |
7 | - Authorization: `Bearer ${process.env.SEARCH_KEY}`, | 7 | + Authorization: `Bearer ${process.env.REACT_APP_SEARCH_KEY}`, |
8 | }, | 8 | }, |
9 | }); | 9 | }); |
10 | 10 | ||
11 | -export const search = async searchWord => { | 11 | +export const esApi = { |
12 | + search: async searchWord => { | ||
12 | const res = await esInstance.post( | 13 | const res = await esInstance.post( |
13 | - `/api/as/v1/engines/${process.env.APP_SEARCH_ENGINE_NAME}/search`, | 14 | + `/api/as/v1/engines/${process.env.REACT_APP_ENGINE_NAME}/search`, |
14 | { | 15 | { |
15 | query: searchWord, | 16 | query: searchWord, |
16 | } | 17 | } |
17 | ); | 18 | ); |
18 | 19 | ||
19 | - console.log(res); | 20 | + return res.data; |
20 | - return res; | 21 | + }, |
21 | }; | 22 | }; | ... | ... |
-
Please register or login to post a comment