Skip to content

Make hooks more generic #23

Open
Open
@claustres

Description

@claustres

A lot of hooks are to be used as before OR after hooks while they could be used in both cases. This is mostly due to the fact that we directly access data or result on the hook object instead of using the generic Feathers utility functions getItems()/replaceItems().

We recently introduced callOnHookItems() to apply a given function on hook items to support such use cases. It should be used whenever possible.

Moreover hooks reading/writing data like readJson/writeJson are writing/reading data to/from a default path like result.data, which is not aware of the type of the hook. The data path should adapt itself to be more easy to use, eg data.data in a before hook and result.data in an after hook.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      Stand-by

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions