forked from rvecilla/reptceipts-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (23 loc) · 732 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import React, { Component } from "react";
import { AppRegistry, AsyncStorage } from "react-native";
import App from "./App/App";
import { AUTH_USER } from "./App/Actions/Auth";
import sStorage from "./App/Actions/Storage";
// redux
import { createStore, applyMiddleware } from "redux";
import { Provider } from "react-redux";
import appReducer from "./App/Reducers";
import thunk from "redux-thunk";
const store = createStore(appReducer, applyMiddleware(thunk));
sStorage.getItem("token").then(token => {
if (token) {
store.dispatch({ type: AUTH_USER });
}
});
// App
const Reptceipts = () => (
<Provider store={store}>
<App />
</Provider>
);
AppRegistry.registerComponent("ReptceiptsMobile", () => Reptceipts);