Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for creating ressource #38

Open
MaximeDetaille opened this issue May 19, 2023 · 2 comments
Open

Error for creating ressource #38

MaximeDetaille opened this issue May 19, 2023 · 2 comments

Comments

@MaximeDetaille
Copy link

Hello,

Im using your provider for strapi and when i want to create a ressource i got an error from strapi because "data" is missing from request
Capture d’écran 2023-05-19 à 10 14 02
Capture d’écran 2023-05-19 à 10 14 13

I updated your provider for making working it by updating this line

Capture d’écran 2023-05-19 à 10 15 37

By this one

Capture d’écran 2023-05-19 à 10 15 59

And all working well. But i really dont know if im doing good ...

@timiil
Copy link

timiil commented Jun 8, 2023

same question, use the sample , Article entity, if we dont upload thumbmail image, it will failed in create Article

@VadSiam
Copy link

VadSiam commented Sep 4, 2024

@MaximeDetaille in latest 5.1.3 version (or maybe older) you suppose to use 'transform' method like here:

import { CardActions } from '@mui/material';
import { Create, ListButton, SaveButton, SimpleForm, TextInput, Toolbar, required } from 'react-admin';

const transformUser = data => ({
  data,
});

const CustomToolbar = props => {
  return (
    <Toolbar {...props} style={{ display: 'flex', justifyContent: 'flex-end' }}>
      <SaveButton type="button" transform={transformUser} />
    </Toolbar>
  )
};

export const SchemeCreate = (props) => (
  <Create {...props}>
    <SimpleForm style={{ width: '90vw' }} toolbar={<CustomToolbar />}>
      <TextInput fullWidth source="name" validate={[required()]} />
      <TextInput fullWidth source="defaultPrompt" multiline rows={5} />
    </SimpleForm>
  </Create>
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants