@cegal/ui-utils
TypeScript icon, indicating that this package has built-in type declarations

0.9.3 • Public • Published

UI

UI utilities we can use for our prokects

fetch

This is a fetch utility that can mock results, simulate different HTTP statues, and dispatches actions for request/success/failure events

How to use

import { fetch } from '@cegal/ui-utils'

and in your code, add this as an action:

const fetchSomething = (params) => {
  return fetch.call({
    url: YOUR_API_URL_HERE,
    expectedPayload: {
      'add here': 'your expected mocked response'
    },
    type: {
    request: 'YOUR_ACTION_FOR_REQUEST',
    success: 'YOUR_ACTION_FOR_SUCCESS',
    failure: 'YOUR_ACTION_FOR_FAILURE'
    }
  })
}

Note that this will return a Promise, so please use it in a Redux project with thunk middleware.

Change logs

Visit design.cegal.com/change-log

How to use it

install from npm.

npm install --save @cegal/ui-utils

See design.cegal.com on how to use the React components

License

Go to Licence

Readme

Keywords

none

Package Sidebar

Install

npm i @cegal/ui-utils

Weekly Downloads

1

Version

0.9.3

License

none

Unpacked Size

103 kB

Total Files

21

Last publish

Collaborators

  • nunocardoso