Skip to content

Commit

Permalink
Adding try catch for username promise
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
  • Loading branch information
aaronchongth committed Jul 4, 2023
1 parent 79e53f1 commit 294ff12
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/dashboard/src/components/appbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,12 @@ export const AppBar = React.memo(({ extraToolbarItems }: AppBarProps): React.Rea
return;
}
(async () => {
const user = (await rmf.defaultApi.getUserUserGet()).data;
setUsername(user.username);
try {
const user = (await rmf.defaultApi.getUserUserGet()).data;
setUsername(user.username);
} catch (e) {
console.log(`error getting username: ${(e as Error).message}`);
}
})();
}, [rmf]);

Expand Down

0 comments on commit 294ff12

Please sign in to comment.