mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Add Notification Provider
This commit is contained in:
@@ -14,8 +14,10 @@ export async function POST(request: NextRequest) {
|
||||
const body = await request.json();
|
||||
const { name, type, config } = schema.parse(body);
|
||||
|
||||
const parsedConfig = JSON.parse(config);
|
||||
|
||||
const notification = await prisma.notificationProvider.create({
|
||||
data: { name, type: type as NotificationType, config, tests: {} },
|
||||
data: { name, type: type as NotificationType, config: parsedConfig},
|
||||
});
|
||||
|
||||
return NextResponse.json({ notification }, { status: 201 });
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
import Sidebar from '@/components/Sidebar';
|
||||
import ErrorToast from '@/components/Error';
|
||||
import SuccessToast from '@/components/Success';
|
||||
import { ProfileSettings } from '@/components/cards/settings/ProfileSettings';
|
||||
import { PasswordSettings } from '@/components/cards/settings/PasswordSettings';
|
||||
import { NotificationSettings } from '@/components/cards/settings/NotificationSettings';
|
||||
import { useState } from 'react';
|
||||
|
||||
interface SettingsPageProps {
|
||||
@@ -14,7 +16,7 @@ interface SettingsPageProps {
|
||||
|
||||
export default function SettingsPage({ username, name, email }: SettingsPageProps) {
|
||||
const [error, setError] = useState('');
|
||||
|
||||
const [success, setSuccess] = useState('');
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -57,13 +59,14 @@ export default function SettingsPage({ username, name, email }: SettingsPageProp
|
||||
<div className="tab-content relative bg-base-100 pl-4 pt-4">
|
||||
<div className="absolute -top-[3px] left-6 right-0 h-[2px] bg-stone-800"></div>
|
||||
<div className="flex flex-col gap-4">
|
||||
test
|
||||
<NotificationSettings onError={setError} onSuccess={setSuccess} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</Sidebar>
|
||||
<ErrorToast message={error} show={error !== ''} onClose={() => setError('')} />
|
||||
<SuccessToast message={success} show={success !== ''} onClose={() => setSuccess('')} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user