mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-01-18 02:18:05 +00:00
Updated: Enhance null safety and set default URL in EditMonitor.vue
- Added optional chaining to safely access `this.monitor.hostname`. - Introduced default URL (`https://`) assignment to `this.monitor.url`. - Ensured `hostname` is trimmed after the URL is set. modified: src/pages/EditMonitor.vue
This commit is contained in:
parent
488e542ad8
commit
33ebfefc58
1 changed files with 6 additions and 1 deletions
|
@ -1719,7 +1719,12 @@ message HealthCheckResponse {
|
|||
this.monitor.headers = JSON.stringify(JSON.parse(this.monitor.headers), null, 4);
|
||||
}
|
||||
|
||||
if (this.monitor.hostname) {
|
||||
// Check if the 'monitor' object exists and contains a 'hostname' property.
|
||||
if (this.monitor?.hostname) {
|
||||
// Initialize the 'url' property of 'monitor' to the base URL scheme.
|
||||
this.monitor.url = "https://";
|
||||
|
||||
// Remove any leading or trailing spaces from the 'hostname' value.
|
||||
this.monitor.hostname = this.monitor.hostname.trim();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue