2022-09-05 02:24:11 +08:00
|
|
|
import Layout from './components/layout'
|
|
|
|
import {Routes, Route} from 'react-router-dom'
|
|
|
|
import {useEffect} from "react";
|
|
|
|
import Home from './pages/Home/Home'
|
|
|
|
import NotFound from './pages/NotFound'
|
|
|
|
import {Bill, BillContext} from "./store";
|
|
|
|
import './App.css'
|
2022-09-05 17:57:22 +08:00
|
|
|
import Record from "./pages/Record/Record";
|
2022-09-05 02:24:11 +08:00
|
|
|
|
|
|
|
function App() {
|
|
|
|
const billStore = new Bill()
|
|
|
|
const now = new Date()
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
billStore.fetch(now.getFullYear(), now.getMonth() + 1)
|
|
|
|
.then()
|
|
|
|
.catch(console.dir)
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="App">
|
|
|
|
<BillContext.Provider value={billStore}>
|
|
|
|
<Layout home>
|
|
|
|
<Routes>
|
|
|
|
<Route path={"/"} element={<Home/>}/>
|
|
|
|
<Route path={"/home"} element={<Home/>}/>
|
2022-09-05 17:57:22 +08:00
|
|
|
<Route path={"/record"} element={<Record/>}/>
|
2022-09-09 14:04:39 +08:00
|
|
|
<Route path={"/*"} element={<NotFound/>}/>
|
2022-09-05 02:24:11 +08:00
|
|
|
</Routes>
|
|
|
|
</Layout>
|
|
|
|
</BillContext.Provider>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App
|