mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
Feature: Auth (#4)
* feat(api): add auth * feat(web): add auth and refactor * refactor(web): baseurl * feat: add autobrrctl cli for user creation * build: move static assets * refactor(web): auth guard and routing * refactor: rename var * fix: remove subrouter * build: update default config
This commit is contained in:
parent
2e8d0950c1
commit
40b855bf39
56 changed files with 1208 additions and 257 deletions
|
@ -1,17 +1,10 @@
|
|||
import React, {useEffect, useState} from 'react';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
import Base from "./screens/Base";
|
||||
|
||||
import {BrowserRouter as Router,} from "react-router-dom";
|
||||
import {ReactQueryDevtools} from 'react-query/devtools'
|
||||
import {QueryClient, QueryClientProvider} from 'react-query'
|
||||
|
||||
import {RecoilRoot, useRecoilState} from 'recoil';
|
||||
import {configState} from "./state/state";
|
||||
import APIClient from "./api/APIClient";
|
||||
import {RecoilRoot} from 'recoil';
|
||||
import {APP} from "./domain/interfaces";
|
||||
import App from "./App";
|
||||
|
||||
declare global {
|
||||
interface Window { APP: APP; }
|
||||
|
@ -19,43 +12,11 @@ declare global {
|
|||
|
||||
window.APP = window.APP || {};
|
||||
|
||||
export const queryClient = new QueryClient()
|
||||
|
||||
const ConfigWrapper = () => {
|
||||
const [config, setConfig] = useRecoilState(configState)
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
APIClient.config.get().then(res => {
|
||||
setConfig(res)
|
||||
setLoading(false)
|
||||
})
|
||||
|
||||
}, [setConfig])
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{loading ? null : (
|
||||
<Router basename={config.base_url}>
|
||||
<Base/>
|
||||
</Router>
|
||||
)}
|
||||
<ReactQueryDevtools initialIsOpen={false}/>
|
||||
</QueryClientProvider>
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<RecoilRoot>
|
||||
<ConfigWrapper/>
|
||||
<App />
|
||||
</RecoilRoot>
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue