aboutsummaryrefslogtreecommitdiff
path: root/frontend/src
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-10-22 13:10:10 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-10-22 13:10:10 +0300
commit87d03e1fe251af6ed2da397bbf4ff512edb8bc69 (patch)
tree000e6fe7b3f11c9ab3126dae255c982f19dd070b /frontend/src
parentfrontend: update profile after upload run (diff)
downloadlphub-87d03e1fe251af6ed2da397bbf4ff512edb8bc69.tar.gz
lphub-87d03e1fe251af6ed2da397bbf4ff512edb8bc69.tar.bz2
lphub-87d03e1fe251af6ed2da397bbf4ff512edb8bc69.zip
frontend: update profile after upload run
Diffstat (limited to 'frontend/src')
-rw-r--r--frontend/src/App.tsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index bcc56fe..e39e1b6 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -45,10 +45,9 @@ const App: React.FC = () => {
45 setGames(games); 45 setGames(games);
46 }; 46 };
47 47
48 const _set_profile = async (user_id: string | undefined) => { 48 const _set_profile = async (user_id?: string) => {
49 if (user_id) { 49 if (user_id && token) {
50 setProfile({} as UserProfile); // placeholder before we call actual user profile 50 const user = await API.get_profile(token);
51 const user = await API.get_profile(token!);
52 setProfile(user); 51 setProfile(user);
53 } 52 }
54 }; 53 };
@@ -58,6 +57,7 @@ const App: React.FC = () => {
58 setProfile(undefined); 57 setProfile(undefined);
59 setIsModerator(false); 58 setIsModerator(false);
60 } else { 59 } else {
60 setProfile({} as UserProfile); // placeholder before we call actual user profile
61 _set_profile(get_user_id_from_token(token)) 61 _set_profile(get_user_id_from_token(token))
62 const modStatus = get_user_mod_from_token(token) 62 const modStatus = get_user_mod_from_token(token)
63 if (modStatus) { 63 if (modStatus) {
@@ -83,7 +83,7 @@ const App: React.FC = () => {
83 <> 83 <>
84 <UploadRunDialog token={token} open={uploadRunDialog} onClose={(updateProfile) => { 84 <UploadRunDialog token={token} open={uploadRunDialog} onClose={(updateProfile) => {
85 setUploadRunDialog(false); 85 setUploadRunDialog(false);
86 if (token) { 86 if (updateProfile && token) {
87 _set_profile(get_user_id_from_token(token)); 87 _set_profile(get_user_id_from_token(token));
88 } 88 }
89 }} games={games} /> 89 }} games={games} />