import type { SettingsUpdate } from '../../shared/api/types/settings';
import { useUpdateSettings } from '../../shared/api/useSettings';
import { useNotifyOutcome } from '../../shared/ui/useNotifyOutcome';

export function useSaveSettings() {
	const updateSettings = useUpdateSettings();
	const notifyOutcome = useNotifyOutcome();

	return ( update: SettingsUpdate, successText: string ) => {
		updateSettings.mutate( update, notifyOutcome( successText ) );
	};
}
