aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/App.tsx19
1 files changed, 10 insertions, 9 deletions
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 754f5a2..4a99625 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -1,4 +1,4 @@
1import React from 'react'; 1import React, { useCallback } from 'react';
2import { Routes, Route } from 'react-router-dom'; 2import { Routes, Route } from 'react-router-dom';
3import { Helmet } from 'react-helmet'; 3import { Helmet } from 'react-helmet';
4 4
@@ -26,9 +26,7 @@ const App: React.FC = () => {
26 undefined 26 undefined
27 ); 27 );
28 const [isModerator, setIsModerator] = React.useState<boolean>(false); 28 const [isModerator, setIsModerator] = React.useState<boolean>(false);
29
30 const [games, setGames] = React.useState<Game[]>([]); 29 const [games, setGames] = React.useState<Game[]>([]);
31
32 const [uploadRunDialog, setUploadRunDialog] = React.useState<boolean>(false); 30 const [uploadRunDialog, setUploadRunDialog] = React.useState<boolean>(false);
33 31
34 const _fetch_token = async () => { 32 const _fetch_token = async () => {
@@ -41,12 +39,15 @@ const App: React.FC = () => {
41 setGames(games); 39 setGames(games);
42 }; 40 };
43 41
44 const _set_profile = async (user_id?: string) => { 42 const _set_profile = useCallback(
45 if (user_id && token) { 43 async (user_id?: string) => {
46 const user = await API.get_profile(token); 44 if (user_id && token) {
47 setProfile(user); 45 const user = await API.get_profile(token);
48 } 46 setProfile(user);
49 }; 47 }
48 },
49 [token]
50 );
50 51
51 React.useEffect(() => { 52 React.useEffect(() => {
52 if (token === undefined) { 53 if (token === undefined) {