Dynamic title
This commit is contained in:
parent
211b0144f8
commit
81db09fc7f
|
@ -22,6 +22,11 @@
|
||||||
|
|
||||||
$: data = (config as Partial<OAuth2Config>) ?? {}
|
$: data = (config as Partial<OAuth2Config>) ?? {}
|
||||||
|
|
||||||
|
$: isCreation = !config
|
||||||
|
$: title = isCreation
|
||||||
|
? "Create new OAuth2 connection"
|
||||||
|
: "Edit OAuth2 connection"
|
||||||
|
|
||||||
const requiredString = (errorMessage: string) =>
|
const requiredString = (errorMessage: string) =>
|
||||||
z.string({ required_error: errorMessage }).trim().min(1, errorMessage)
|
z.string({ required_error: errorMessage }).trim().min(1, errorMessage)
|
||||||
|
|
||||||
|
@ -66,11 +71,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!config) {
|
if (isCreation) {
|
||||||
await oauth2.create(validationResult.data)
|
await oauth2.create(validationResult.data)
|
||||||
notifications.success("Settings created.")
|
notifications.success("Settings created.")
|
||||||
} else {
|
} else {
|
||||||
await oauth2.edit(config.id, validationResult.data)
|
await oauth2.edit(config!.id, validationResult.data)
|
||||||
notifications.success("Settings saved.")
|
notifications.success("Settings saved.")
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
@ -85,7 +90,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent onConfirm={saveOAuth2Config} size="M">
|
<ModalContent onConfirm={saveOAuth2Config} size="M">
|
||||||
<Heading size="S">Create new OAuth2 connection</Heading>
|
<Heading size="S">{title}</Heading>
|
||||||
|
|
||||||
<Body size="S">
|
<Body size="S">
|
||||||
The OAuth 2 authentication below uses the Client Credentials (machine to
|
The OAuth 2 authentication below uses the Client Credentials (machine to
|
||||||
|
|
Loading…
Reference in New Issue