diff --git a/src/index.tsx b/src/index.tsx index 2bcefd5..60ddaf2 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,17 +2,14 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; import ThemeContextProvider from "./utils/contexts/ThemeContext"; -import AuthContextProvider from "./utils/contexts/AuthContext"; const root = ReactDOM.createRoot( document.getElementById('root') as HTMLElement ); root.render( - - - - - + + + ); \ No newline at end of file diff --git a/src/utils/contexts/AuthContext.tsx b/src/utils/contexts/AuthContext.tsx deleted file mode 100644 index c1b21bc..0000000 --- a/src/utils/contexts/AuthContext.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import React from "react"; - -const AUTH_URL = `http://${process.env.REACT_APP_API_URL}/auth`; - -interface IAuthContext { - sessionToken: string -} - -const AuthContext = React.createContext({ - sessionToken: '' -}); - -export const useAuth = () => React.useContext(AuthContext); - -const AuthContextProvider = ({children}: any) => { - const [sessionToken] = React.useState(''); - - React.useEffect(() => { - const token = window.localStorage.getItem('session_token'); - if (!token) { - fetch(AUTH_URL, { - method: 'GET' - }).then(res => res.json()).then(token => { - window.localStorage.setItem('session_token', token); - }); - } - }, []); - - return ( - - {children} - - ); -}; - -export default AuthContextProvider; \ No newline at end of file