@rns-fe/webfetch
v0.1.10
Published
web project fetch
Downloads
6
Readme
webFetch
apis for rns proj
Usege
- setting config data as follow
/*
getLanguage?: () => string; // get current language must be a func else is default 'en'
baseUrl?: () => string; // get base request url
showMessage?: (content: string, type: string | 'success' | 'error' | 'normal' | 'warning') => void; // set how to display error message
noAuth?: () => void; // when auth error will call this
getToken?: () => string; // get system token
timeOutInterval?: number; // get time out interval default 60s
needLog?: boolean; // whether need log
headers?: () => RawAxiosRequestHeaders; // request headers
*/
setConfigData({
getLanguage: () => 'jp',
getToken: () => state.user.token,
baseUrl: () => Config.API_URL!,
needLog: Config.ENV == 'dev',
noAuth: () => dispatch({ type: userActions.logout, payload: { token: null } })
headers: () => {return {sign: md5string, udid: udidstring}}
})
- call api when use
import { idendtfyService } from '@rns/webfetch'
idendtfyService.identityCard().then((res) => {
// success
}).catch((e: any) => {
// fail
})
Build
// call build