0

`I am trying to add a Relation in the Menu, but the relation items arent loading.

This request keeps hitting :

POST /admin/plugins/menus/edit/menus/relations/page_otm?limit=20&start=0 (0 ms) 405 instead of : POST /menus/relations/page_otm?limit=20&start=0 (0 ms) 405 strapi-server.js:

'use strict';

module.exports = plugin => { // Get current MenuItem` attributes. const defaultAttrs = plugin.contentTypes[ 'menu-item' ].schema.attributes;

// Define custom attributes for MenuItem the same way they would be defined // on any other schema. const customAttrs = { page_otm: { type: 'relation', relation: 'oneToOne', target: 'api::page.page', }, };

// Extend the MenuItem content type with custom attributes. plugin.contentTypes[ 'menu-item' ].schema.attributes = { ...defaultAttrs, ...customAttrs, };

return plugin; };`

plugins.js:

menus: { config: { maxDepth: 2, layouts: { menuItem: { link: [ { input: { label: 'Linked Page', name: 'page_otm', type: 'relation', }, grid: { col: 6, }, }, ], }, }, }, },

strapi version: 4.2.3 strapi-plugin-menus version: 1.0.2

I tried setting the STRAPI_ADMIN_BACKEND_URL variable in env which actually helps redirecting to right call, but our pipeline is such that we build code once and use the same in diff environments -> dev,qa,prod. and this variable has to be set before build and does not automatically takes the updated value on env file.`

0 Answers0