mirror of
https://github.com/twentyhq/twenty.git
synced 2026-08-01 10:12:06 -04:00
Starting the frontend(`nx start twenty-front`) was failing because one of its dependencies - the client SDK - can not be built. A recent update made the sdk compatible with a newer version of Prettier. That update started using parts of prettier that the build setup did not recognize, so the build stopped with an error about a missing module. This PR updated the SDK’s build configuration, so it correctly handles those prettier imports. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/21519?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. --> --------- Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
23 lines
854 B
TypeScript
23 lines
854 B
TypeScript
import { type Page } from '@playwright/test';
|
|
|
|
// Mirrors TOKEN_PAIR_LOCAL_STORAGE_KEY from twenty-front
|
|
// (packages/twenty-front/src/modules/auth/states/tokenPairState.ts).
|
|
// Since #21507 the frontend stores the auth token pair in localStorage
|
|
// instead of a cookie.
|
|
const TOKEN_PAIR_LOCAL_STORAGE_KEY = 'tokenPairState';
|
|
|
|
export const getAccessAuthToken = async (page: Page) => {
|
|
const storageState = await page.context().storageState();
|
|
const tokenPairItem = storageState.origins
|
|
.flatMap((origin) => origin.localStorage)
|
|
.find((item) => item.name === TOKEN_PAIR_LOCAL_STORAGE_KEY);
|
|
|
|
if (tokenPairItem === undefined) {
|
|
throw new Error('No auth token pair found in local storage');
|
|
}
|
|
|
|
const { accessOrWorkspaceAgnosticToken } = JSON.parse(tokenPairItem.value);
|
|
|
|
return { authToken: accessOrWorkspaceAgnosticToken.token };
|
|
};
|