X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fpages%2FUser.js;fp=resources%2Fjs%2Fcomponents%2Fpages%2FUser.js;h=0000000000000000000000000000000000000000;hb=16662be0b3432d67307ae8c2bb798362d77bab99;hp=144e4c01d86418c46bd16cc53f567556399420b8;hpb=d8ca13d8ccb5efe181198d0e5243a26c9f807aa1;p=alttp.git
diff --git a/resources/js/components/pages/User.js b/resources/js/components/pages/User.js
deleted file mode 100644
index 144e4c0..0000000
--- a/resources/js/components/pages/User.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import axios from 'axios';
-import React, { useEffect, useState } from 'react';
-import { Helmet } from 'react-helmet';
-import { useParams } from 'react-router-dom';
-
-import CanonicalLinks from '../common/CanonicalLinks';
-import ErrorBoundary from '../common/ErrorBoundary';
-import ErrorMessage from '../common/ErrorMessage';
-import Loading from '../common/Loading';
-import NotFound from '../pages/NotFound';
-import Profile from '../users/Profile';
-
-const User = () => {
- const params = useParams();
- const { id } = params;
-
- const [error, setError] = useState(null);
- const [loading, setLoading] = useState(true);
- const [user, setUser] = useState(null);
-
- useEffect(() => {
- setLoading(true);
- const ctrl = new AbortController();
- axios
- .get(`/api/users/${id}`, { signal: ctrl.signal })
- .then(response => {
- setError(null);
- setLoading(false);
- setUser(response.data);
- })
- .catch(error => {
- setError(error);
- setLoading(false);
- setUser(null);
- });
- return () => {
- ctrl.abort();
- };
- }, [id]);
-
- useEffect(() => {
- const cb = (e) => {
- if (e.user) {
- setUser(user => e.user.id === user.id ? { ...user, ...e.user } : user);
- }
- };
- window.Echo.channel('App.Control')
- .listen('UserChanged', cb);
- return () => {
- window.Echo.channel('App.Control')
- .stopListening('UserChanged', cb);
- };
- }, []);
-
- if (loading) {
- return ;
- }
-
- if (error) {
- return ;
- }
-
- if (!user) {
- return ;
- }
-
- return
-
- {user.nickname || user.username}
-
-
-
- ;
-};
-
-export default User;