Search code examples
admin-on-rest

DeleteButton triggers "Incorrect Element"


I'm implementing an asp.net core API with admin-on-rest. A custom REST client communicates to the API endpoints, but the mapping is fairly standard.

When I try to implement a into the interface, the deletion of elements works fine. Still, I get an error on every edit or deletion view for an element with the following text: "Incorrect Element". The console is empty, and everything works as expected.

What causes the error - and how can I solve this?

I've attached a screenshot of the error popup.

Screenshot of the error

Update 1: Here is the code of my custom REST client: customrestclient gist and the included fetch.js: fetch.js


Solution

  • I was finally able to fix the issue. One of my API endpoints returned a list instead of a single element for one of my ReferenceInput-elements.

    This was the content response before my change:

    [{
        "languageId": 2,
        "id": 2,
        "name": "Danish",
        "isoCode": "dan"
    }]
    

    And this is the correct response, that does not trigger the error:

    {
        "languageId": 2,
        "id": 2,
        "name": "Danish",
        "isoCode": "dan"
    }