Repository: louislam/uptime-kuma
File: src/pages/EditMonitor.vue (Vue)

Code before:
                        this.monitor.notificationIDList[this.$root.notificationList[i].id] = true;
                    }
                }
            } else if (this.isEdit) {
                this.$root.getSocket().emit("getMonitor", this.$route.params.id, (res) => {
                    if (res.ok) {
                        this.monitor = res.monitor;

                        // Handling for monitors that are created before 1.7.0
                        if (this.monitor.retryInterval === 0) {
                            this.monitor.retryInterval = this.monitor.interval;
                        }
                    } else {
                        toast.error(res.msg);
                    }
                });
            }

        },

        isInputValid() {
            if (this.monitor.body) {
                try {
                    JSON.parse(this.monitor.body);
                } catch (err) {
                    toast.error(this.$t("The request body is not valid json: ") + err.message);
                    return false;
                }
            }
            if (this.monitor.headers) {
                if (!/^([^:]+:.*)([\s]+[^:]+:.*)+$/g.test(this.monitor.headers)) {
                    toast.error(this.$t("Headers do not have a valid format: \"key: value<new line>key: value<new line>...\""));
                    return false;
                }
            }
            return true;
        },

        async submit() {
            this.processing = true;

            if (!this.isInputValid()) {
                this.processing = false;
                return;
            }

            if (this.isAdd) {
                this.$root.add(this.monitor, async (res) => {

                    if (res.ok) {
                        await this.$refs.tagsManager.submit(res.monitorID);

Review comment (suggestion):
```suggestion
                    toast.error(this.$t("The request body is not valid JSON: ") + err.message);
```

Code after:
                for (let i = 0; i < this.$root.notificationList.length; i++) {
                    if (this.$root.notificationList[i].isDefault == true) {
                        this.monitor.notificationIDList[this.$root.notificationList[i].id] = true;
                    }
                }
            } else if (this.isEdit) {
                this.$root.getSocket().emit("getMonitor", this.$route.params.id, (res) => {
                    if (res.ok) {
                        this.monitor = res.monitor;

                        // Handling for monitors that are created before 1.7.0
                        if (this.monitor.retryInterval === 0) {
                            this.monitor.retryInterval = this.monitor.interval;
                        }
                    } else {
                        toast.error(res.msg);
                    }
                });
            }

        },

        isInputValid() {
            if (this.monitor.body) {
                try {
                    JSON.parse(this.monitor.body);
                } catch (err) {
                    toast.error(this.$t("BodyInvalidFormat") + err.message);
                    return false;
                }
            }
            if (this.monitor.headers) {
                try {
                    JSON.parse(this.monitor.headers);
                } catch (err) {
                    toast.error(this.$t("HeadersInvalidFormat") + err.message);
                    return false;
                }
            }
            return true;
        },

        async submit() {
            this.processing = true;

            if (!this.isInputValid()) {
                this.processing = false;
                return;
            }

            if (this.isAdd) {