Implemented a feature to check the availability of subdomains when updating workspace settings. This includes a new mutation, `isSubdomainAvailable`, to validate subdomain availability through GraphQL. The frontend now verifies if a subdomain is available to prevent duplicates during updates. --------- Co-authored-by: Weiko <corentin@twenty.com>
22 lines
685 B
TypeScript
22 lines
685 B
TypeScript
import { cookieStorageEffect } from '~/utils/recoil-effects';
|
|
import { createState } from 'twenty-ui';
|
|
|
|
export const lastAuthenticatedWorkspaceDomainState = createState<
|
|
| {
|
|
subdomain: string;
|
|
workspaceId: string;
|
|
cookieAttributes?: Cookies.CookieAttributes;
|
|
}
|
|
| null
|
|
// this type is necessary to let the deletion of cookie. Without the domain the cookie is not deleted.
|
|
| { cookieAttributes?: Cookies.CookieAttributes }
|
|
>({
|
|
key: 'lastAuthenticateWorkspaceDomain',
|
|
defaultValue: null,
|
|
effects: [
|
|
cookieStorageEffect('lastAuthenticateWorkspaceDomain', {
|
|
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year
|
|
}),
|
|
],
|
|
});
|