0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(console): external link should use to the correct URL in protected app details (#5317)

This commit is contained in:
Charles Zhao 2024-01-26 13:05:53 +08:00 committed by GitHub
parent f2e978d2d9
commit c7237e1aff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,10 +53,16 @@ function ProtectedAppSettings({ data }: Props) {
name: 'protectedAppMetadata.pageRules',
});
const host = data.protectedAppMetadata?.host;
if (!data.protectedAppMetadata) {
return null;
}
const { host } = data.protectedAppMetadata;
// We only support one custom domain for protected apps at the moment.
const customDomain = customDomains[0];
const externalLink = `https://${
customDomain?.status === DomainStatus.Active ? customDomain.domain : host
}`;
return (
<>
@ -68,7 +74,6 @@ function ProtectedAppSettings({ data }: Props) {
targetBlank: 'noopener',
}}
>
{!!host && (
<div className={styles.launcher}>
<span>{t('protected_app.success_message')}</span>
<Button
@ -77,16 +82,10 @@ function ProtectedAppSettings({ data }: Props) {
title="application_details.try_it"
trailingIcon={<ExternalLinkIcon />}
onClick={() => {
window.open(
`https://${
customDomain?.status === DomainStatus.Active ? customDomain.domain : host
}`,
'_blank'
);
window.open(externalLink, '_blank');
}}
/>
</div>
)}
<FormField isRequired title="application_details.application_name">
<TextInput
{...register('name', { required: true })}
@ -127,11 +126,11 @@ function ProtectedAppSettings({ data }: Props) {
{t('application_details.app_domain_protected_description_1')}
</div>
<div className={styles.hostInUse}>
<span className={styles.host}>{data.protectedAppMetadata?.host}</span>
<span className={styles.host}>{host}</span>
<DomainStatusTag status={DomainStatus.Active} />
<Spacer />
<CopyToClipboard value={host} variant="icon" />
<OpenExternalLink link={host} />
<OpenExternalLink link={externalLink} />
</div>
</>
)}