ForestAdmin / forest-express-sequelize

🌱 Express/Sequelize agent for Forest Admin to integrate directly to your existing Express/Sequelize backend application.
https://www.forestadmin.com
GNU General Public License v3.0
191 stars 48 forks source link

cannot set endpoint and values function same time into actions #266

Closed jeromequeyrou closed 5 years ago

jeromequeyrou commented 5 years ago

Hi everyone, i use forest-express-sequelize 2.16.9 I have a problem when i try to add an action to a collection with default value on a field. When i create my action like this :

Liana.collection('test', {
  actions: [
    {
      name: 'test it',
      type: 'single',
      fields: [{
        field: 'bar',
        description: 'test with default values',
        type: 'Number',
        isRequired: true,
      }],
      values : (context) => {
        return { bar: context.foo }
      }
    }],
});

the default value is set to the field but when i add an endpoint to the actions, the default value is not set.

i specified it on the action

actions : [
   {
     ....,
    endpoint : "forest/actions/test"
   }
]
arnaudbesnier commented 5 years ago

Hi @jeromequeyrou thanks for the feedback. Can you try with: endpoint: "/forest/action/test"? I think it should work.

Let me know.

arnaudbesnier commented 5 years ago

A fix that should automatically add a missing "/" character has been release in a new v3.2.5 version.

Let me close the thread, but feel free to reopen it if the issue persists after the update. Thanks