Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat($resource): add support for wrapped responses #6138

Open
@stephenleicht

Description

@stephenleicht

$resource cannot handle a response that has the data you want wrapped in a object that has additional metadata.

for example if the response from the server is:

{
    "meta": {
        "total_count": 100
    },
    "items": [/*Some sort of list of objects*/]
}

You lose a lot of the cool $resource features because your resource is actually the 'items' field and not the entire response.

transformRepsponse does not work for this because if you pull out the 'items' field there you lose the meta field data.

response interceptor doesn't work because by the time you get it has already been decorated as a Resource object.

there should probably be an additional field in the action configuration to specify what field in the response should be decorated as a Resource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions