1.2.0 • Published 3 years ago

gel-logic v1.2.0

Weekly downloads
4
License
MIT
Repository
-
Last release
3 years ago

gel-logic

LogicKit for GEL generic.

0. useAsync - use async functions inside a hook

1. API Hooks
1.1. useApi  - axios hook
1.2. useGet  - HTTP GET hook
1.3. usePost - HTTP POST hook
1.4. usePatch - HTTP PATCH hook
1.5. usePut - HTTP PUT hook
1.6. useDelete - HTTP DELETE hook

2. Auth Hooks
2.1. useAuth - fetch and persist JWT via OAuth password grant type. 
2.2. useFunctionGroups - RBAC with functional groups

3. Form Management 
3.1. useFormik  - simple hooks for from validation with much simpler API than formik 

4. Route Hooks
4.1. useRouter - simple route management

5. Caching
5.1. useStorage - use a storage strategy for persistsing state client side
5.2. useCookieStorage - store in cookies
5.3. useSessionStorage - store in session
5.4. useLocalStorage  - store in local storage 

6. UI State
6.1. useJourney  - manage state for the wizard flow 
6.2. useTabs  - manage state for tab layout 

Install and Run

yarn

To view the Logic kit in action you can run the storybook or see the tutorial

Publish

Use semantic commit messages to auto publish versions

To manually version and publish

# fix 
npm version patch 

    # or feature 
    npm version minor 

    # or breaking change
    npm version major

# publish
npm publish

Story

yarn run story

Pull Requests

Use semantic commits and semantic release

or manually:

Patch - fix or tweak
[patch] {description}
fix: 
Minor - New feature
[minor] {description}
feat: 
Major - Breaking change
[major] {description}
* breaking change: 

Docs

0. useAsync

use async functions inside a hook

import { useAync } from 'gel-generic'; 

1. API Hooks

1.1. useApi

axios hook

import { useApi } from 'gel-generic'; 

This hook is composed of:

  • useAsync

1.2. useGet

HTTP GET hook

import { useGet } from 'gel-generic'; 

This hook is composed of:

  • useApi

1.3. usePost

HTTP POST hook

import { usePost } from 'gel-generic'; 

This hook is composed of:

  • useApi

1.4. usePatch

HTTP PATCH hook

import { usePatch } from 'gel-generic'; 

This hook is composed of:

  • useApi

1.5. usePut

HTTP PUT hook

import { usePut } from 'gel-generic'; 

This hook is composed of:

  • useApi

1.6. useDelete

HTTP DELETE hook

import { useDelete } from 'gel-generic'; 

This hook is composed of:

  • useApi

2. Auth Hooks

2.1. useAuth

fetch and persist JWT via OAuth password grant type.

import { useAuth } from 'gel-generic'; 

This hook is composed of:

  • useApi

2.2. useFunctionGroups

RBAC with functional groups

import { useFunctionalGroups } from 'gel-generic'; 

3. Form Management

3.1. useFormik

simple hooks for from validation with much simpler API than formik

import { useFormik } from 'gel-generic'; 

This hook is composed of:

4. Route Hooks

4.1. useRouter

simple route management

This hook is composed of:

5. Caching

5.1. useStorage

use a storage strategy for persistsing state client side

import { useStorage } from 'gel-generic'; 

This hook is composed of:

  • useCookieStorage
  • useSessionStorage
  • useLocalStorage

5.2. useCookieStorage

store in cookies

import { useCookieStorage } from 'gel-generic'; 

5.3. useSessionStorage

store in session

import { useSessionStorage } from 'gel-generic'; 

5.4. useLocalStorage

store in local storage

import { useLocalStorage } from 'gel-generic'; 

6. UI State

6.1. useJourney

manage state for the wizard flow

import { useJourney } from 'gel-generic'; 

6.2. useTabs

manage state for tab layout

import { useJourney } from 'gel-generic';