Skip to content

Commit

Permalink
fix(async-await): add prefix await before getUserData function and re…
Browse files Browse the repository at this point in the history
…navigate root
  • Loading branch information
ngyngcphu committed Sep 19, 2023
1 parent e2b5cca commit 00ad52c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function App() {
{
type: 'item',
icon: <HomeIcon className='h-5 w-5' />,
path: '/home',
path: '/',
name: 'Trang chủ',
element: <HomePage />
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/AuthPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export const AuthPage = () => {
const submit = async (data: LoginFormData) => {
try {
await authService.login(data);
getUserData();
navigate('/home');
await getUserData();
navigate('/');
} catch (err) {
const errorMessage = (err as ResponseError).message;
toast.error(errorMessage);
Expand Down

0 comments on commit 00ad52c

Please sign in to comment.