added check for undefined (#19949)

fixes: #19883
This commit is contained in:
Erik Jan de Wit 2023-04-27 08:51:16 +02:00 committed by GitHub
parent d7d50634b3
commit 9e8f5bb45c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,12 @@ import { SaveReset } from "../advanced/SaveReset";
import type { ClientSettingsProps } from "../ClientSettings";
import { FormFields } from "../ClientDetails";
const validateUrl = (uri: string | undefined, error: string) =>
((uri?.startsWith("https://") || uri?.startsWith("http://")) &&
!uri.includes("*")) ||
uri === "" ||
error;
export const LogoutPanel = ({
save,
reset,
@ -92,10 +98,7 @@ export const LogoutPanel = ({
),
{
validate: (uri) =>
((uri.startsWith("https://") || uri.startsWith("http://")) &&
!uri.includes("*")) ||
uri === "" ||
t("frontchannelUrlInvalid").toString(),
validateUrl(uri, t("frontchannelUrlInvalid").toString()),
}
)}
validated={
@ -136,11 +139,7 @@ export const LogoutPanel = ({
),
{
validate: (uri) =>
((uri.startsWith("https://") ||
uri.startsWith("http://")) &&
!uri.includes("*")) ||
uri === "" ||
t("backchannelUrlInvalid").toString(),
validateUrl(uri, t("backchannelUrlInvalid").toString()),
}
)}
validated={