fix: onboarding loop (#775)
* fix: dashboard workspace activity mutation * fix: onboarding loop
This commit is contained in:
parent
22c1f6f8e2
commit
725c9375ea
4 changed files with 33 additions and 6 deletions
|
|
@ -24,6 +24,7 @@ import Logo from "public/onboarding/logo.svg";
|
|||
import type { NextPage } from "next";
|
||||
// fetch-keys
|
||||
import { CURRENT_USER } from "constants/fetch-keys";
|
||||
import { ICurrentUserResponse } from "types";
|
||||
|
||||
const Onboarding: NextPage = () => {
|
||||
const [step, setStep] = useState(1);
|
||||
|
|
@ -76,7 +77,21 @@ const Onboarding: NextPage = () => {
|
|||
userService
|
||||
.updateUserOnBoard({ userRole })
|
||||
.then(() => {
|
||||
mutate(CURRENT_USER);
|
||||
mutate<ICurrentUserResponse>(
|
||||
CURRENT_USER,
|
||||
(prevData) => {
|
||||
if (!prevData) return prevData;
|
||||
|
||||
return {
|
||||
...prevData,
|
||||
user: {
|
||||
...prevData.user,
|
||||
is_onboarded: true,
|
||||
},
|
||||
};
|
||||
},
|
||||
false
|
||||
);
|
||||
router.push("/");
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue