mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
refactor(console): refresh preview on custom phrases updated (#2083)
This commit is contained in:
parent
691bdb3ac9
commit
a2d59cd0ff
2 changed files with 4 additions and 2 deletions
|
@ -27,6 +27,7 @@ const useUiLanguages = () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
customPhrases: customPhraseList,
|
||||||
languages,
|
languages,
|
||||||
error,
|
error,
|
||||||
isLoading: !customPhraseList && !error,
|
isLoading: !customPhraseList && !error,
|
||||||
|
|
|
@ -33,6 +33,7 @@ const Preview = ({ signInExperience, className }: Props) => {
|
||||||
const [platform, setPlatform] = useState<'desktopWeb' | 'mobile' | 'mobileWeb'>('desktopWeb');
|
const [platform, setPlatform] = useState<'desktopWeb' | 'mobile' | 'mobileWeb'>('desktopWeb');
|
||||||
const { data: allConnectors } = useSWR<ConnectorResponse[], RequestError>('/api/connectors');
|
const { data: allConnectors } = useSWR<ConnectorResponse[], RequestError>('/api/connectors');
|
||||||
const previewRef = useRef<HTMLIFrameElement>(null);
|
const previewRef = useRef<HTMLIFrameElement>(null);
|
||||||
|
const { customPhrases } = useUiLanguages();
|
||||||
|
|
||||||
const { languages } = useUiLanguages();
|
const { languages } = useUiLanguages();
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ const Preview = ({ signInExperience, className }: Props) => {
|
||||||
}, [allConnectors, language, mode, platform, signInExperience]);
|
}, [allConnectors, language, mode, platform, signInExperience]);
|
||||||
|
|
||||||
const postPreviewMessage = useCallback(() => {
|
const postPreviewMessage = useCallback(() => {
|
||||||
if (!config) {
|
if (!config || !customPhrases) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ const Preview = ({ signInExperience, className }: Props) => {
|
||||||
{ sender: 'ac_preview', config },
|
{ sender: 'ac_preview', config },
|
||||||
window.location.origin
|
window.location.origin
|
||||||
);
|
);
|
||||||
}, [config]);
|
}, [config, customPhrases]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
postPreviewMessage();
|
postPreviewMessage();
|
||||||
|
|
Loading…
Reference in a new issue