refacto(*): rename hostname to custom domain (#10100)
This commit is contained in:
@ -0,0 +1,28 @@
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { useEffect } from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { useGetCustomDomainDetailsQuery } from '~/generated/graphql';
|
||||
|
||||
export const SettingsCustomDomainEffect = () => {
|
||||
const { refetch } = useGetCustomDomainDetailsQuery();
|
||||
|
||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||
|
||||
useEffect(() => {
|
||||
let pollIntervalFn: null | ReturnType<typeof setInterval> = null;
|
||||
if (isDefined(currentWorkspace?.customDomain)) {
|
||||
pollIntervalFn = setInterval(async () => {
|
||||
refetch();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (isDefined(pollIntervalFn)) {
|
||||
clearInterval(pollIntervalFn);
|
||||
}
|
||||
};
|
||||
}, [currentWorkspace?.customDomain, refetch]);
|
||||
|
||||
return <></>;
|
||||
};
|
||||
Reference in New Issue
Block a user