]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/pages/User.js
first half of AoS generator
[alttp.git] / resources / js / components / pages / User.js
index 8dfdba45311aa410a0fbd0a858f3278bf4182912..3e868babb57f852190bf48e5d40511f1476d1361 100644 (file)
@@ -18,18 +18,23 @@ const User = () => {
 
        useEffect(() => {
                setLoading(true);
+               const ctrl = new AbortController();
                axios
-                       .get(`/api/users/${id}`)
+                       .get(`/api/users/${id}`, { signal: ctrl.signal })
                        .then(response => {
                                setError(null);
                                setLoading(false);
                                setUser(response.data);
+                               window.document.title = response.data.nickname || response.data.username;
                        })
                        .catch(error => {
                                setError(error);
                                setLoading(false);
                                setUser(null);
                        });
+               return () => {
+                       ctrl.abort();
+               };
        }, [id]);
 
        useEffect(() => {