Closed vadymfrlv closed 6 months ago
I'd honestly suggest using ApiClient
to send requests to the backend:
import { ApiClient } from 'adminjs'
const api = new ApiClient()
await api.recordAction({
recordId: record.id,
resourceId: 'Order',
actionName: 'toggleStatus',
method: 'post',
data: {
offer_status: newValue
}
})
TypeError: Cannot read properties of undefined (reading 'params')
doesn't really tell much except that it couldn't find a record with given id in the database. All record actions have a record set in context
even before before
hooks are run unless it cannot find that record.
Contact Details
No response
What happened?
In the list I created a custom component (checkbox). When I checked it or unchecked must be a record to DB to change status like false or true. Could not understand what is wrong while trying to update a param of an object in DB through custom component in adminjs.
Receiving
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
``
Bug prevalence
Every time I try to make a check
AdminJS dependencies version
{ "name": "admin-test", "version": "1.0.0", "description": "Admin test", "main": "index.js", "type": "module", "scripts": { "start": "nodemon index.js" }, "author": "frlv", "license": "ISC", "dependencies": { "@adminjs/design-system": "^4.1.0", "@adminjs/express": "^6.1.0", "@adminjs/mongoose": "^4.1.0", "@babel/register": "^7.23.7", "adminjs": "^7.7.0", "express": "^4.18.3", "express-formidable": "^1.2.0", "mongoose": "^8.2.1" }, "devDependencies": { "@babel/cli": "^7.23.9", "@babel/core": "^7.24.0", "@babel/preset-env": "^7.24.0", "@babel/preset-react": "^7.23.3", "nodemon": "^3.1.0" } }
What browsers do you see the problem on?
No response
Relevant log output
No response
Relevant code that's giving you issues