import { getErrorMessage, useAppSelector, useUpdatePluginMutation } from "@/lib/store"; import { MaximConfigSchema, MaximFormSchema } from "@/lib/types/schemas"; import { useMemo } from "react"; import { toast } from "sonner"; import { MaximFormFragment } from "../../fragments/maximFormFragment"; interface MaximViewProps { onDelete?: () => void; isDeleting?: boolean; } export default function MaximView({ onDelete, isDeleting }: MaximViewProps) { const selectedPlugin = useAppSelector((state) => state.plugin.selectedPlugin); const [updatePlugin] = useUpdatePluginMutation(); const currentConfig = useMemo( () => ({ ...((selectedPlugin?.config as MaximConfigSchema) ?? {}), enabled: selectedPlugin?.enabled }), [selectedPlugin], ); const handleMaximConfigSave = (config: MaximFormSchema): Promise => { return new Promise((resolve, reject) => { updatePlugin({ name: "maxim", data: { enabled: config.enabled, config: config.maxim_config, }, }) .unwrap() .then(() => { toast.success("Maxim configuration updated successfully"); resolve(); }) .catch((err) => { toast.error("Failed to update Maxim configuration", { description: getErrorMessage(err), }); reject(err); }); }); }; return (
Configuration
You can send in header x-bf-log-repo-id with a repository ID to log to a specific repository.
); }