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:
@@ -32,7 +32,6 @@ const EVENT_TYPES = [
|
||||
{ value: 'wedding', label: 'Wedding', emoji: '💒' },
|
||||
{ value: 'birthday', label: 'Birthday', emoji: '🎂' },
|
||||
{ value: 'corporate', label: 'Corporate', emoji: '🏢' },
|
||||
{ value: 'party', label: 'Party', emoji: '🎉' },
|
||||
{ value: 'other', label: 'Other', emoji: '📸' },
|
||||
];
|
||||
|
||||
@@ -126,8 +125,6 @@ export const CreateEventPage: React.FC = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const expiresAt = addDays(new Date(), formData.expires_in_days);
|
||||
|
||||
createMutation.mutate({
|
||||
event_type: formData.event_type,
|
||||
event_name: formData.event_name,
|
||||
@@ -135,9 +132,9 @@ export const CreateEventPage: React.FC = () => {
|
||||
host_email: formData.host_email,
|
||||
admin_email: formData.admin_email,
|
||||
password: formData.password,
|
||||
welcome_message: formData.welcome_message || undefined,
|
||||
welcome_message: formData.welcome_message || '',
|
||||
color_theme: formData.color_theme || undefined,
|
||||
expires_at: expiresAt.toISOString(),
|
||||
expiration_days: formData.expires_in_days,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -78,8 +78,7 @@ export const EventDetailsPage: React.FC = () => {
|
||||
// Extend expiration mutation
|
||||
const extendMutation = useMutation({
|
||||
mutationFn: (days: number) => {
|
||||
const newDate = addDays(parseISO(event!.expires_at), days);
|
||||
return eventsService.extendExpiration(parseInt(id!), newDate.toISOString());
|
||||
return eventsService.extendExpiration(parseInt(id!), days);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['admin-event', id] });
|
||||
|
||||
@@ -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