5663 i should be able to accept an invite even if i have an inactive workspace (#5839)

- make invitation and reset password available on every page
- add a sleep after setKeyPair as tokens are sometimes not updated when
redirecting to Index
- refactor sleep
This commit is contained in:
martmull
2024-06-13 11:47:00 +02:00
committed by GitHub
parent d93c2d6408
commit b26fd00a40
30 changed files with 95 additions and 75 deletions

View File

@ -4,7 +4,7 @@ import { expect, userEvent, within } from '@storybook/test';
import { ComponentDecorator } from 'twenty-ui';
import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';
import { sleep } from '~/testing/sleep';
import { sleep } from '~/utils/sleep';
import { IconPicker, IconPickerProps } from '../IconPicker';

View File

@ -5,6 +5,7 @@ import { tokenPairState } from '@/auth/states/tokenPairState';
import { AppPath } from '@/types/AppPath';
import { useGenerateJwtMutation } from '~/generated/graphql';
import { isDefined } from '~/utils/isDefined';
import { sleep } from '~/utils/sleep';
export const useWorkspaceSwitching = () => {
const setTokenPair = useSetRecoilState(tokenPairState);
@ -29,6 +30,7 @@ export const useWorkspaceSwitching = () => {
const { tokens } = jwt.data.generateJWT;
setTokenPair(tokens);
await sleep(0); // This hacky workaround is necessary to ensure the tokens stored in the cookie are updated correctly.
window.location.href = AppPath.Index;
};