Posts

Showing posts from June, 2022

To replace all common words in react

  { responsee . toString (). split ( "<br>" ). join ( " \n " ) }

Fetch API with services

 FETCH API.js import AsyncStorage from '@react-native-async-storage/async-storage' ; import { url as API_HOST } from './Api/api' ; // refresh token const refreshToken = async ( uid , token ) => { console . log ( "REFRESH" , token ) var requestUrl = API_HOST + `CustomerApp/RefreshAccessToken` ; var options = { method : 'POST' , headers : { Authorization : token , 'client-code' : 'customerapp' , 'Content-Type' : 'application/json' , }, body : JSON . stringify ({ uid }) }; const result = await fetch ( requestUrl , options ). then (( response ) => { const data = response . json (); AsyncStorage . setItem ( 'userData' , JSON . stringify ( data )) return result }); return result } export async function fetch_api ( url , method , data = null , retry = false ) ...

Pass Props with navigation

  < TouchableOpacity onPress = { () => this . props . navigation . navigate ( 'OpenServiceClick' , { itemId : data . TSR_SYS_ID , }) } >       OTHER SIDE       this . props . route . params . itemId       const text = this.props.navigation.getParam('text', 'nothing sent')