Enhance the message notification feature

This commit is contained in:
yoan
2024-09-24 22:39:42 +08:00
parent 4c9095400e
commit ac4904fb9a
18 changed files with 1322 additions and 337 deletions

View File

@@ -8,6 +8,7 @@ import { useEffect, useState } from "react";
import { update } from "@/repository/settings";
import { getErrMessage } from "@/lib/error";
import { useToast } from "../ui/use-toast";
import { isValidURL } from "@/lib/url";
type WebhookSetting = {
id: string;
@@ -55,6 +56,16 @@ const Webhook = () => {
const handleSaveClick = async () => {
try {
webhook.data.url = webhook.data.url.trim();
if (!isValidURL(webhook.data.url)) {
toast({
title: "保存失败",
description: "Url格式不正确",
variant: "destructive",
});
return;
}
const resp = await update({
...config,
name: "notifyChannels",