diff --git a/app/dashboard/settings/Settings.tsx b/app/dashboard/settings/Settings.tsx index 98ed016..32edb68 100644 --- a/app/dashboard/settings/Settings.tsx +++ b/app/dashboard/settings/Settings.tsx @@ -53,6 +53,9 @@ import { Textarea } from "@/components/ui/textarea"; interface NotificationsResponse { notifications: any[]; } +interface NotificationResponse { + notification_text?: string; +} export default function Settings() { const { theme, setTheme } = useTheme(); @@ -84,6 +87,8 @@ export default function Settings() { const [notifications, setNotifications] = useState([]) + const [notificationText, setNotificationText] = useState("") + const changeEmail = async () => { setEmailErrorVisible(false); setEmailSuccess(false); @@ -217,6 +222,35 @@ export default function Settings() { }, []) + const getNotificationText = async () => { + try { + const response = await axios.post('/api/settings/get_notification_text', {}); + if (response.status === 200) { + if (response.data.notification_text) { + setNotificationText(response.data.notification_text); + } else { + setNotificationText("The application !name (!url) is now !status."); + } + } + } catch (error: any) { + alert(error.response.data.error); + } + }; + + const editNotificationText = async () => { + try { + const response = await axios.post('/api/settings/notification_text', { + text: notificationText + }); + } catch (error: any) { + alert(error.response.data.error); + } + } + + useEffect(() => { + getNotificationText() + }, []) + return ( @@ -531,16 +565,24 @@ export default function Settings() { Customize Notification Text -
-
- -