mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
fix the order of useMutation so the hook isn't called conditionally
This commit is contained in:
parent
6748d0a625
commit
d4252cff16
1 changed files with 6 additions and 6 deletions
|
|
@ -66,12 +66,6 @@ const ModalSubmit = ({
|
|||
// This is a client component so we can access the session directly
|
||||
const session = useSession();
|
||||
|
||||
if (!session.data) {
|
||||
// The user is not logged in, redirect them to sign in
|
||||
router.push("/");
|
||||
return null;
|
||||
}
|
||||
|
||||
const { mutate, isLoading } = useMutation(createPortfolio, {
|
||||
onSuccess: (data) => {
|
||||
router.push(`/portfolio/${data.id}`);
|
||||
|
|
@ -82,6 +76,12 @@ const ModalSubmit = ({
|
|||
},
|
||||
});
|
||||
|
||||
if (!session.data) {
|
||||
// The user is not logged in, redirect them to sign in
|
||||
router.push("/");
|
||||
return null;
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
const userId = session.data.user.dbId;
|
||||
const status = "scoping";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue