Spaces:
Build error
Build error
| import axios from 'axios'; | |
| import config from "../config"; | |
| const searchUrl = config.searchUrl; | |
| /** | |
| * Perform a search query. | |
| * @param {string} query - The search query. | |
| * @returns {Promise<Object>} - The search results. | |
| */ | |
| export const search = async (query) => { | |
| try { | |
| const response = await axios.post(searchUrl, { query }); | |
| console.log(response); | |
| return response.data; | |
| } catch (error) { | |
| console.error("Error performing search:", error); | |
| throw error; // Rethrow the error to be handled by the caller | |
| } | |
| }; | |