rival-black
rival-black12mo ago

Does someone has an example for a page

Does someone has an example for a page in react for editing a singleton in the backend?
5 Replies
robust-apricot
robust-apricot12mo ago
Hello @itaysmalia you can check our app-crm example's settings page implementation: https://github.com/refinedev/refine/blob/master/examples/app-crm/src/routes/administration/settings.tsx We also have a this component which handles updating user data: https://github.com/refinedev/refine/blob/master/examples/app-crm/src/components/layout/account-settings/index.tsx If you go to this URL: https://example.crm.refine.dev/administration/settings And at the top right, click image, then click Account Settings.
GitHub
refine/examples/app-crm/src/routes/administration/settings.tsx at m...
A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility. - refinedev/refine
GitHub
refine/examples/app-crm/src/components/layout/account-settings/inde...
A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility. - refinedev/refine
No description
correct-apricot
correct-apricot12mo ago
The company info looks like what is need, but it's not fetching or updating any data on the backend, my main problem us that both useForm and useEdit hooks requires passing an id field and shows a warning if I pass an empty id
robust-apricot
robust-apricot12mo ago
You can check 2nd example I sent you: https://discord.com/channels/837692625737613362/1192587033055592528/1192739435113087057 If your backend doesn't require ID to update, you can ignore the warning. We added that in case people accidently dont send id
correct-apricot
correct-apricot12mo ago
Does it also appear on production builds?
robust-apricot
robust-apricot12mo ago
We are using warn-once package for these warnings. https://www.npmjs.com/package/warn-once So, if you have process.env.NODE_ENV set to production, it will not print anything. https://github.com/satya164/warn-once/blob/main/index.js You can see where we use it here: https://github.com/refinedev/refine/blob/master/packages/core/src/hooks/form/useForm.ts
npm
warn-once
Show a warning once. Latest version: 0.1.1, last published: a year ago. Start using warn-once in your project by running npm i warn-once. There are 37 other projects in the npm registry using warn-once.
GitHub
warn-once/index.js at main · satya164/warn-once
Show a warning once. Contribute to satya164/warn-once development by creating an account on GitHub.
GitHub
refine/packages/core/src/hooks/form/useForm.ts at master · refinede...
A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility. - refinedev/refine