Open
Description
Description
React generator has problem with paths for resources.
I generated a client using https://demo.api-platform.com/, while the generated routes have paths like /admin/books/create
the Show components has paths like <Navigate to="/books/" replace />
How to reproduce
- Generate a client with
rm -rf ./tmp && yarn build && ENTRYPOINT=https://demo.api-platform.com/ ./testgen.sh react
- Go to
tmp/react/routes/book.tsx
you will see
const routes = [
<Route path="/admin/books/create" element={<Create />} key="create" />,
<Route path="/admin/books/edit/:id" element={<Update />} key="update" />,
<Route path="/admin/books/show/:id" element={<Show />} key="show" />,
<Route path="/admin/books" element={<List />} key="list" />,
<Route path="/admin/books/:page" element={<List />} key="page" />,
];
- Go to
tmp/react/components/book/Show.tsx
and you can see
<Link to="/books/" className="btn btn-primary">
Back to list
</Link>
Possible Solution
Use the same variable in all template when generating routes and links
Additional Context
PR here : #377
Metadata
Metadata
Assignees
Labels
No labels