Fix multiple production issues and add password change functionality
- Fixed frontend API URL configuration to use correct port 3002 - Fixed create event functionality by adding proper endpoint and fixing JSON parsing - Fixed email settings save functionality by importing logActivity correctly - Fixed admin settings save functionality by using api client instead of direct fetch - Implemented password change functionality with modal and backend endpoint - Added updated_at column to admin_users table - Fixed all mock data issues - now using real backend data throughout 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -84,18 +84,12 @@ export const SettingsPage: React.FC = () => {
|
||||
// Save mutations
|
||||
const saveGeneralMutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
// Save each setting
|
||||
const promises = Object.entries(generalSettings).map(([key, value]) =>
|
||||
fetch('/api/admin/settings/general', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${localStorage.getItem('adminToken')}`
|
||||
},
|
||||
body: JSON.stringify({ [`general_${key}`]: value })
|
||||
})
|
||||
);
|
||||
await Promise.all(promises);
|
||||
// Convert to the format expected by the API
|
||||
const settingsData: Record<string, any> = {};
|
||||
Object.entries(generalSettings).forEach(([key, value]) => {
|
||||
settingsData[`general_${key}`] = value;
|
||||
});
|
||||
return settingsService.updateSettings(settingsData);
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success('General settings saved successfully');
|
||||
@@ -108,18 +102,12 @@ export const SettingsPage: React.FC = () => {
|
||||
|
||||
const saveSecurityMutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
// Save each setting
|
||||
const promises = Object.entries(securitySettings).map(([key, value]) =>
|
||||
fetch('/api/admin/settings/security', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${localStorage.getItem('adminToken')}`
|
||||
},
|
||||
body: JSON.stringify({ [`security_${key}`]: value })
|
||||
})
|
||||
);
|
||||
await Promise.all(promises);
|
||||
// Convert to the format expected by the API
|
||||
const settingsData: Record<string, any> = {};
|
||||
Object.entries(securitySettings).forEach(([key, value]) => {
|
||||
settingsData[`security_${key}`] = value;
|
||||
});
|
||||
return settingsService.updateSettings(settingsData);
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success('Security settings saved successfully');
|
||||
|
||||
Reference in New Issue
Block a user