diff options
Diffstat (limited to 'frontend/src/App.tsx')
| -rw-r--r-- | frontend/src/App.tsx | 10 |
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} /> |