mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: email invite accept validation (#2965)
* fix: empty state flickering on accepting only invitation * fix: redirection from workspace-invitaion to onboarding * chore: onboarding step 1 skip on accepting invite from email * fix: dashboard redirection path
This commit is contained in:
parent
de9c1a60e0
commit
dbc8150852
@ -63,11 +63,11 @@ export const Invitations: React.FC<Props> = (props) => {
|
||||
.joinWorkspaces({ invitations: invitationsRespond })
|
||||
.then(async (res) => {
|
||||
postHogEventTracker("WORKSPACE_USER_INVITE_ACCEPT", { ...res, state: "SUCCESS" });
|
||||
await mutateInvitations();
|
||||
await workspaceStore.fetchWorkspaces();
|
||||
await mutate(USER_WORKSPACES);
|
||||
await updateLastWorkspace();
|
||||
await handleNextStep();
|
||||
await mutateInvitations();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
|
@ -213,7 +213,7 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => {
|
||||
image={emptyInvitation}
|
||||
primaryButton={{
|
||||
text: "Back to dashboard",
|
||||
onClick: () => router.push(`/${redirectWorkspaceSlug}`),
|
||||
onClick: () => router.push("/"),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -52,6 +52,10 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
|
||||
},
|
||||
});
|
||||
|
||||
useSWR(`USER_WORKSPACES_LIST`, () => workspaceStore.fetchWorkspaces(), {
|
||||
shouldRetryOnError: false,
|
||||
});
|
||||
|
||||
const { data: invitations } = useSWR("USER_WORKSPACE_INVITATIONS_LIST", () =>
|
||||
workspaceService.userWorkspaceInvitations()
|
||||
);
|
||||
@ -88,6 +92,19 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
|
||||
|
||||
const onboardingStep = user.onboarding_step;
|
||||
|
||||
if (!onboardingStep.workspace_join && !onboardingStep.workspace_create && workspaces && workspaces?.length > 0) {
|
||||
await updateCurrentUser({
|
||||
onboarding_step: {
|
||||
...user.onboarding_step,
|
||||
workspace_join: true,
|
||||
workspace_create: true,
|
||||
},
|
||||
last_workspace_id: workspaces[0].id,
|
||||
});
|
||||
setStep(2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!onboardingStep.workspace_join && !onboardingStep.workspace_create && step !== 1) setStep(1);
|
||||
|
||||
if (onboardingStep.workspace_join || onboardingStep.workspace_create) {
|
||||
|
Loading…
Reference in New Issue
Block a user