Skip to content

Checking status codes using react-fetch #4

Open
@adrienharnay

Description

@adrienharnay

Hello,

I'd like to check status codes using react-fetch, so the code could match this:

fetch(someURL, someOptions)
.then(APIUtils.checkStatus)
.then(response => response.json())
.catch(API.handleUnauthorized);

But when I use:

<Fetch
url=someURL options={someOptions} onSuccess={APIUtils.checkStatus} onError={APIUtils.handleUnauthorized}

The onSuccess function is called after the first .then, after the status codes are checked.

How could I do this using your component?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions