forked from ddrilling/asb_cloud_front
Токен для OpenAPI теперь задаётся асинхронным методом
This commit is contained in:
parent
d51a669937
commit
d92ba25089
29
src/App.js
29
src/App.js
@ -1,22 +1,26 @@
|
|||||||
import './styles/App.less'
|
|
||||||
import {
|
import {
|
||||||
BrowserRouter as Router,
|
BrowserRouter as Router,
|
||||||
Switch,
|
Switch,
|
||||||
Route} from "react-router-dom"
|
Route
|
||||||
import {ConfigProvider} from 'antd'
|
} from 'react-router-dom'
|
||||||
import locale from "antd/lib/locale/ru_RU"
|
import { ConfigProvider } from 'antd'
|
||||||
import Login from './pages/Login'
|
import locale from 'antd/lib/locale/ru_RU'
|
||||||
import Register from './pages/Register'
|
|
||||||
import Main from './pages/Main'
|
|
||||||
import { OpenAPI } from './services/api'
|
import { OpenAPI } from './services/api'
|
||||||
|
import { getUserToken } from './utils/storage'
|
||||||
import { PrivateRoute } from './components/Private'
|
import { PrivateRoute } from './components/Private'
|
||||||
|
|
||||||
|
import Main from './pages/Main'
|
||||||
|
import Login from './pages/Login'
|
||||||
|
import Register from './pages/Register'
|
||||||
|
|
||||||
|
import './styles/App.less'
|
||||||
|
|
||||||
//OpenAPI.BASE = 'http://localhost:3000'
|
//OpenAPI.BASE = 'http://localhost:3000'
|
||||||
OpenAPI.TOKEN = localStorage.getItem('token')
|
OpenAPI.TOKEN = async () => getUserToken()
|
||||||
OpenAPI.HEADERS = {'Content-Type': 'application/json'}
|
OpenAPI.HEADERS = {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
export default function App() {
|
export const App = () => (
|
||||||
return (
|
|
||||||
<ConfigProvider locale={locale}>
|
<ConfigProvider locale={locale}>
|
||||||
<Router>
|
<Router>
|
||||||
<Switch>
|
<Switch>
|
||||||
@ -32,5 +36,6 @@ export default function App() {
|
|||||||
</Switch>
|
</Switch>
|
||||||
</Router>
|
</Router>
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
);
|
)
|
||||||
}
|
|
||||||
|
export default App
|
||||||
|
Loading…
Reference in New Issue
Block a user