ilink-world/index.js

38 lines
943 B
JavaScript
Raw Normal View History

2019-06-16 13:09:54 +00:00
/**
* @format
*/
2020-03-22 11:07:44 +00:00
import 'react-native-gesture-handler';
2020-04-18 19:59:05 +00:00
import { AppRegistry, YellowBox, AsyncStorage } from 'react-native';
2019-06-16 13:09:54 +00:00
import App from './App';
2020-03-20 18:28:22 +00:00
import { name as appName } from './app.json';
2020-04-18 19:59:05 +00:00
import axios from "axios";
2020-03-20 18:28:22 +00:00
YellowBox.ignoredYellowBox = ['Warning: Each', 'Warning: Failed'];
console.disableYellowBox = true;
2020-04-18 19:59:05 +00:00
getAuthToken = () => {
return new Promise(async (resolve, reject) => {
try {
const data = await AsyncStorage.getItem('persist:root');
resolve(JSON.parse(data))
} catch (error) {
reject(error)
}
})
};
(async () => {
const authToken = await getAuthToken();
const auth = JSON.parse(authToken.authKeyReducer);
console.log("AUTHTOKEN", auth);
axios.defaults.headers.common['Authorization'] = `${auth.authKey.token_type} ${auth.authKey.access_token}`;
})();
2019-06-16 13:09:54 +00:00
AppRegistry.registerComponent(appName, () => App);