diff --git a/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx b/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx index 7a9f63c..ef3609e 100644 --- a/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx +++ b/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx @@ -43,7 +43,24 @@ export default function EditTemplate() { console.log('Fetching template for:', eventId, channelId); const response = await api.get(`/notifications/templates/${eventId}/${channelId}`); console.log('API Response:', response); - return response.data; + console.log('API Response.data:', response.data); + console.log('API Response type:', typeof response); + + // The api.get might already unwrap response.data + // Return the response directly if it has the template fields + if (response && (response.subject !== undefined || response.body !== undefined)) { + console.log('Returning response directly:', response); + return response; + } + + // Otherwise return response.data + if (response && response.data) { + console.log('Returning response.data:', response.data); + return response.data; + } + + console.error('No valid template data found in response'); + return null; }, enabled: !!eventId && !!channelId, });