Commit bc128b98 authored by d.arizona's avatar d.arizona

tambahan

parent 4fddb389
// a library to wrap and simplify api calls // a library to wrap and simplify api calls
import apisauce from 'apisauce' import apisauce from 'apisauce'
import Constant from '../library/Constant'
// our "constructor" // our "constructor"
const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') => { const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') => {
...@@ -25,13 +26,13 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') ...@@ -25,13 +26,13 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
api.addAsyncRequestTransform(request => async () => { api.addAsyncRequestTransform(request => async () => {
var token var token
try { try {
// const res = await AsyncStorage.getItem("TOKEN") const res = await localStorage.getItem(Constant.TOKEN)
if (token != null) { if (token != null) {
token = token token = res
// alert(url) // alert(url)
// api.setBaseURL(`${url}/api/`) // api.setBaseURL(`${url}/api/`)
} else { } else {
token = null token = res
// url = Constant.BASE_URL.MASTER + '/api/' // url = Constant.BASE_URL.MASTER + '/api/'
// alert(url) // alert(url)
// api.setBaseURL(`${url}/api/`) // api.setBaseURL(`${url}/api/`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment