fix: onboarding loop (#775)

* fix: dashboard workspace activity mutation

* fix: onboarding loop
This commit is contained in:
Aaryan Khandelwal 2023-04-11 12:25:21 +05:30 committed by GitHub
parent 22c1f6f8e2
commit 725c9375ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 6 deletions

View file

@ -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) => {