autobrr/web/src/App.tsx
stacksmash76 fe06363530
chore: add eslint and cleanup (#118)
* refactor: modified existing react imports to conform with the recommended approach of not using the default export directly, since it will be deprecated in one of the future releases. see https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html for more info. note: react types don't require importing of react.
refactor: cleaned up some of the imports

* feat: added eslint and fixed all the errors/warning. eslint can now be invoked by running "npm run lint".
chore: updated .gitignore not to include unnecessary artefacts.
refactor: re-organized some of the imports.

* refactor: converted remaining few typed functional components to proper prop argument structure.

* fix: fixed small react-query invalidation bug for the FilterDetails component.

Co-authored-by: anonymous <anonymous>
2022-02-08 18:10:47 +01:00

42 lines
No EOL
1.3 KiB
TypeScript

import { QueryClient, QueryClientProvider } from "react-query";
import { BrowserRouter as Router, Route } from "react-router-dom";
import { ReactQueryDevtools } from "react-query/devtools";
import { Toaster } from "react-hot-toast";
import Base from "./screens/Base";
import Login from "./screens/auth/login";
import Logout from "./screens/auth/logout";
import { baseUrl } from "./utils";
import { AuthContext, SettingsContext } from "./utils/Context";
function Protected() {
return (
<>
<Toaster position="top-right" />
<Base />
</>
)
}
export const queryClient = new QueryClient();
export function App() {
const authContext = AuthContext.useValue();
const settings = SettingsContext.useValue();
return (
<QueryClientProvider client={queryClient}>
<Router basename={baseUrl()}>
{authContext.isLoggedIn ? (
<Route exact path="/*" component={Protected} />
) : (
<Route exact path="/*" component={Login} />
)}
<Route exact path="/logout" component={Logout} />
</Router>
{settings.debug ? (
<ReactQueryDevtools initialIsOpen={false} />
) : null}
</QueryClientProvider>
)
}