Repository: louislam/uptime-kuma
File: src/components/settings/Notifications.vue (Vue)

Code before:
             */
            expiryNotifInput: null,
        };
    },

    computed: {
        settings() {
            return this.$parent.$parent.$parent.settings;
        },
        saveSettings() {
            return this.$parent.$parent.$parent.saveSettings;
        },
        settingsLoaded() {
            return this.$parent.$parent.$parent.settingsLoaded;
        },
    },

    watch: {
        // Parse, store and apply new timeout settings.
        toastSuccessTimeoutSecs: function (newTimeout) {
            const parsedTimeout = parseInt(newTimeout);
            if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) {
                localStorage.toastSuccessTimeout = newTimeout > 0 ? newTimeout * 1000 : newTimeout;
            }
        },
        toastErrorTimeoutSecs: function (newTimeout) {
            const parsedTimeout = parseInt(newTimeout);
            if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) {
                localStorage.toastErrorTimeout = newTimeout > 0 ? newTimeout * 1000 : newTimeout;
            }
        }
    },

    mounted() {
        this.loadToastTimeoutSettings();
    },

    methods: {
        /**
         * Remove a day from expiry notification days.
         * @param {number} day The day to remove.
         */
        removeExpiryNotifDay(day) {
            this.settings.tlsExpiryNotifyDays = this.settings.tlsExpiryNotifyDays.filter(d => d !== day);
        },
        /**
         * Add a new expiry notification day.
         * Will verify:
         * - day is not null or empty string.
         * - day is a number.
         * - day is > 0.

Review comment (suggestion):
```suggestion
        toastErrorTimeoutSecs(newTimeout) {
```

Code after:
             */
            expiryNotifInput: null,
        };
    },

    computed: {
        settings() {
            return this.$parent.$parent.$parent.settings;
        },
        saveSettings() {
            return this.$parent.$parent.$parent.saveSettings;
        },
        settingsLoaded() {
            return this.$parent.$parent.$parent.settingsLoaded;
        },
    },

    watch: {
        // Parse, store and apply new timeout settings.
        toastSuccessTimeoutSecs(newTimeout) {
            const parsedTimeout = parseInt(newTimeout);
            if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) {
                localStorage.toastSuccessTimeout = newTimeout > 0 ? newTimeout * 1000 : newTimeout;
            }
        },
        toastErrorTimeoutSecs(newTimeout) {
            const parsedTimeout = parseInt(newTimeout);
            if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) {
                localStorage.toastErrorTimeout = newTimeout > 0 ? newTimeout * 1000 : newTimeout;
            }
        }
    },

    mounted() {
        this.loadToastTimeoutSettings();
    },

    methods: {
        /**
         * Remove a day from expiry notification days.
         * @param {number} day The day to remove.
         * @returns {void}
         */
        removeExpiryNotifDay(day) {
            this.settings.tlsExpiryNotifyDays = this.settings.tlsExpiryNotifyDays.filter(d => d !== day);
        },
        /**
         * Add a new expiry notification day.
         * Will verify:
         * - day is not null or empty string.
         * - day is a number.