Spaces:
Paused
Paused
Update handlers/search-catalog.js
Browse files- handlers/search-catalog.js +13 -10
handlers/search-catalog.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
-
// handlers/
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// handlers/search-catalog.js
|
| 2 |
+
module.exports = (dependencies) => {
|
| 3 |
+
return async function searchCatalog({ type, id, extra }) {
|
| 4 |
+
try {
|
| 5 |
+
// Your logic for searching the catalog
|
| 6 |
+
const response = await dependencies.axios.get(`your-api-url/${id}`, { params: { extra } });
|
| 7 |
+
return response.data;
|
| 8 |
+
} catch (error) {
|
| 9 |
+
console.error('Error in searchCatalog:', error);
|
| 10 |
+
throw new Error('Error in searchCatalog handler');
|
| 11 |
+
}
|
| 12 |
+
};
|
| 13 |
+
};
|