Skip to content

Commit

Permalink
fix: parse Json
Browse files Browse the repository at this point in the history
  • Loading branch information
MenahemOwlytics authored and blake-r committed Apr 25, 2023
1 parent 2fb7f69 commit 478b5c0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/components/ExportComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ExportComponent = ({ resource }) => {
actionName: 'export',
params: {
type,
filter
filter,
},
});
const blob = new Blob([exportedData], { type: exports.mimeTypes[type] });
Expand Down
4 changes: 2 additions & 2 deletions lib/importExportFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ const importExportFeature = () => {
handler: (0, utils_1.postActionHandler)(export_handler_1.exportHandler),
component: EXPORT_COMPONENT,
actionType: 'resource',
showFilter: true
showFilter: true,
},
import: {
handler: (0, utils_1.postActionHandler)(import_handler_1.importHandler),
component: IMPORT_COMPONENT,
actionType: 'resource',
showFilter: true
showFilter: true,
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const getRecords = async (context, request) => {
.properties()
.find(p => p.isId())) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.call(_a);
const titleProperty = (_d = (_c = context.resource.decorate().titleProperty()) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.call(_c);
return context.resource.find(new adminjs_1.Filter(((_e = request === null || request === void 0 ? void 0 : request.query) === null || _e === void 0 ? void 0 : _e.filter) ? JSON.stringify((_f = request === null || request === void 0 ? void 0 : request.query) === null || _f === void 0 ? void 0 : _f.filter) : {}, context.resource), {
return context.resource.find(new adminjs_1.Filter(((_e = request === null || request === void 0 ? void 0 : request.query) === null || _e === void 0 ? void 0 : _e.filter) ? JSON.parse((_f = request === null || request === void 0 ? void 0 : request.query) === null || _f === void 0 ? void 0 : _f.filter) : {}, context.resource), {
limit: Number.MAX_SAFE_INTEGER,
sort: {
sortBy: idProperty !== null && idProperty !== void 0 ? idProperty : titleProperty,
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const getRecords = async (

return context.resource.find(
new Filter(
request?.query?.filter ? JSON.stringify(request?.query?.filter) : {},
request?.query?.filter ? JSON.parse(request?.query?.filter) : {},
context.resource
),
{
Expand Down

0 comments on commit 478b5c0

Please sign in to comment.