Skip to content

Commit 295da2a

Browse files
committed
fix: save and exit
1 parent 0c38ba0 commit 295da2a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

web-marketplace/src/legacy-pages/ProjectCreate/hooks/useProjectSaveAndExit.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
import { useNavigate } from 'react-router-dom';
2-
31
import { useCreateProjectContext } from '../ProjectCreate';
2+
import { useRouter } from 'next/navigation';
43

54
export const useProjectSaveAndExit = () => {
65
const { formRef, shouldNavigateRef, isOrganizationAccount } =
76
useCreateProjectContext();
8-
const navigate = useNavigate();
7+
const router = useRouter();
98

109
const saveAndExit = async (): Promise<void> => {
1110
if (shouldNavigateRef) {
1211
shouldNavigateRef.current = false;
1312
await formRef?.current?.submitForm(true);
14-
shouldNavigateRef.current = true;
1513
}
16-
if (isOrganizationAccount) navigate('/dashboard/organization/projects');
17-
else navigate('/dashboard/projects');
14+
if (isOrganizationAccount) router.push('/dashboard/organization/projects');
15+
else router.push('/dashboard/projects');
1816
};
1917

2018
return saveAndExit;

0 commit comments

Comments
 (0)