1.0.4 • Published 4 days ago

@cegal/ds-utils v1.0.4

Weekly downloads
-
License
-
Repository
github
Last release
4 days ago

UI utils

UI utilities we can use for our projects

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/ds-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/ds-utils

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

License

Go to Licence

1.0.4

4 days ago

1.0.3

3 months ago

1.0.1

4 months ago

1.0.0

4 months ago

0.99.2

7 months ago

0.99.1

11 months ago

0.99.0

11 months ago