Skip to content

getMenu function fails to fetch menu. #752

Open
@Danishkhurshid

Description

@Danishkhurshid

Package containing the bug

next-drupal (NPM package)

Describe the bug

I am getting an error Error: Resource of type 'menu_items' not found. on trying to fetch menus with getMenu.

After debugging i see that buildEndpoint generates /jsonapi as an endpoint to fetch menus rather than /jsonapi/menu_items/{menu}

Fix:
getMenu should call the buildEndpoint as below by concatenating the path rather than passing menu_items as a resourceType.

   const endpoint = await this.buildEndpoint({
      locale:
        options?.locale !== options?.defaultLocale ? options.locale : undefined,
      path: `/menu_items/${menuName}`,
      searchParams: options.params,
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions