# Content - Introduce the `workspaceUrls` property. It contains two sub-properties: `customUrl, subdomainUrl`. These endpoints are used to access the workspace. Even if the `workspaceUrls` is invalid for multiple reasons, the `subdomainUrl` remains valid. - Introduce `ResolveField` workspaceEndpoints to avoid unnecessary URL computation on the frontend part. - Add a `forceSubdomainUrl` to avoid custom URL using a query parameter
26 lines
959 B
TypeScript
26 lines
959 B
TypeScript
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
|
import { lastAuthenticatedWorkspaceDomainState } from '@/domain-manager/states/lastAuthenticatedWorkspaceDomainState';
|
|
import { domainConfigurationState } from '@/domain-manager/states/domainConfigurationState';
|
|
|
|
export const useLastAuthenticatedWorkspaceDomain = () => {
|
|
const domainConfiguration = useRecoilValue(domainConfigurationState);
|
|
const setLastAuthenticatedWorkspaceDomain = useSetRecoilState(
|
|
lastAuthenticatedWorkspaceDomainState,
|
|
);
|
|
const setLastAuthenticateWorkspaceDomainWithCookieAttributes = (
|
|
params: { workspaceId: string; workspaceUrl: string } | null,
|
|
) => {
|
|
setLastAuthenticatedWorkspaceDomain({
|
|
...(params ? params : {}),
|
|
cookieAttributes: {
|
|
domain: `.${domainConfiguration.frontDomain}`,
|
|
},
|
|
});
|
|
};
|
|
|
|
return {
|
|
setLastAuthenticateWorkspaceDomain:
|
|
setLastAuthenticateWorkspaceDomainWithCookieAttributes,
|
|
};
|
|
};
|