chore: update frontend folder

This commit is contained in:
Steven
2023-08-23 09:13:42 +08:00
parent 40814a801a
commit f5817c575c
129 changed files with 104 additions and 1648 deletions

41
frontend/web/src/App.tsx Normal file
View File

@ -0,0 +1,41 @@
import { useEffect, useState } from "react";
import { Outlet } from "react-router-dom";
import DemoBanner from "./components/DemoBanner";
import { globalService } from "./services";
import useUserStore from "./stores/v1/user";
function App() {
const userStore = useUserStore();
const [loading, setLoading] = useState(true);
useEffect(() => {
const initialState = async () => {
try {
await globalService.initialState();
} catch (error) {
// do nothing
}
try {
await userStore.fetchCurrentUser();
} catch (error) {
// do nothing.
}
setLoading(false);
};
initialState();
}, []);
return !loading ? (
<>
<DemoBanner />
<Outlet />
</>
) : (
<></>
);
}
export default App;