Files
picpeak/frontend/src/services/toast.service.ts
T
paul 2012b0bab9 Fix language setting not being saved to database on admin settings page
- Added default_language field to general settings state in SettingsPage
- Replaced LanguageSelector component with simple select dropdown on settings page
- Fixed public settings endpoint to read general_default_language from database
- Language setting now properly saved when clicking Save Settings button
- Setting is correctly used by gallery login page and legal pages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-08 09:49:45 +02:00

30 lines
1.1 KiB
TypeScript

import { toast as toastify } from 'react-toastify';
import i18n from '../i18n/config';
export const toast = {
success: (messageKey: string, interpolations?: Record<string, any>) => {
const message = i18n.t(messageKey, interpolations);
toastify.success(message);
},
error: (messageKey: string, interpolations?: Record<string, any>) => {
const message = i18n.t(messageKey, interpolations);
toastify.error(message);
},
info: (messageKey: string, interpolations?: Record<string, any>) => {
const message = i18n.t(messageKey, interpolations);
toastify.info(message);
},
warning: (messageKey: string, interpolations?: Record<string, any>) => {
const message = i18n.t(messageKey, interpolations);
toastify.warning(message);
},
// For direct messages (not translation keys)
successDirect: (message: string) => toastify.success(message),
errorDirect: (message: string) => toastify.error(message),
infoDirect: (message: string) => toastify.info(message),
warningDirect: (message: string) => toastify.warning(message),
};