X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fjs%2Fapp%2Findex.js;h=385ed7dff8a88734891fb32f5d5733178195fb35;hb=4e24f36eb5d6907697c106ca15c2c405728d78a8;hp=fcc5311ec6404deaba12e4ed1c16c7f58b75b6f9;hpb=16662be0b3432d67307ae8c2bb798362d77bab99;p=alttp.git
diff --git a/resources/js/app/index.js b/resources/js/app/index.js
index fcc5311..385ed7d 100644
--- a/resources/js/app/index.js
+++ b/resources/js/app/index.js
@@ -1,47 +1,17 @@
-import axios from 'axios';
-import React, { useEffect, useState } from 'react';
+import React from 'react';
import { Helmet } from 'react-helmet';
import { useTranslation } from 'react-i18next';
-import { BrowserRouter } from 'react-router-dom';
import Routes from './Routes';
import AlttpBaseRomProvider from '../helpers/AlttpBaseRomContext';
-import UserContext from '../helpers/UserContext';
+import { SNESProvider } from '../hooks/snes';
+import { UserProvider } from '../hooks/user';
import i18n from '../i18n';
const App = () => {
- const [user, setUser] = useState(null);
-
const { t } = useTranslation();
- const checkAuth = async () => {
- try {
- const response = await axios.get('/api/user');
- setUser(response.data);
- } catch (e) {
- setUser(null);
- }
- };
-
- const doLogout = async () => {
- await axios.post('/logout');
- await checkAuth();
- };
-
- useEffect(() => {
- let timer = null;
- axios
- .get('/sanctum/csrf-cookie')
- .then(() => {
- checkAuth();
- timer = setInterval(checkAuth, 15 * 60 * 1000);
- });
- return () => {
- if (timer) clearInterval(timer);
- };
- }, []);
-
- useEffect(() => {
+ React.useEffect(() => {
window.Echo.channel('App.Control')
.listen('PleaseRefresh', () => {
location.reload();
@@ -51,18 +21,18 @@ const App = () => {
};
}, []);
- return
-
-
+ return
+
+
{t('general.appName')}
-
-
-
- ;
+
+
+
+ ;
};
export default App;