System Information
- Strapi Version: 4.2.0
- Operating System: Windows
- Database: PostgreSQL
I want a webmaster to be able to create pages and manage a menu. I installed the Strapi menus plugin. This lets you create & edit a menu structure in a visual way, which is perfect. The downside of this plugin is that you need to type the URL for the menu item. Instead, I want the webmaster to be able to select a page. So I thought; let’s extend the Strapi menus with a relational type that can select my Page collection type. (Is this the way to go, or is there maybe a simpler solution?)
I made a collection type: Page, which is reachable in the backend via:
http://localhost:1337/admin/content-manager/collectionType/api::page.page
I copied the code from here: Menus | Strapi Market, and edited the target such that is matches my target:
const customAttrs = {
example_relation_one: {
type: 'relation',
relation: 'oneToOne',
target: 'api::page.page',
},
example_relation_many: {
type: 'relation',
relation: 'oneToMany',
target: 'api::page.page',
},
};
The Strapi backend starts and shows the field as expected. However, when I try to select a relation, it gives back a 405 error, which I don’t understand. Why is it trying to post something here in the first place?
What am I doing wrong? Any help would be appreciated!
If you want me to share more details, please let me know.
Thank you,
Melvin