fixes
This commit is contained in:
@@ -12,13 +12,21 @@ export default defineEventHandler(async (event) => {
|
||||
try {
|
||||
const body = await readBody(event);
|
||||
const { id, data } = body;
|
||||
console.log('[update-interest] Request body:', { id, dataKeys: data ? Object.keys(data) : 'none' });
|
||||
console.log('[update-interest] Request body:', {
|
||||
id,
|
||||
idType: typeof id,
|
||||
dataKeys: data ? Object.keys(data) : 'none'
|
||||
});
|
||||
|
||||
if (!id) {
|
||||
console.error('[update-interest] Missing ID in request');
|
||||
throw createError({ statusCode: 400, statusMessage: "ID is required" });
|
||||
}
|
||||
|
||||
// Ensure ID is a string
|
||||
const interestId = String(id);
|
||||
console.log('[update-interest] Using ID:', interestId, 'Type:', typeof interestId);
|
||||
|
||||
if (!data || Object.keys(data).length === 0) {
|
||||
console.error('[update-interest] No data provided for update');
|
||||
throw createError({ statusCode: 400, statusMessage: "No data provided for update" });
|
||||
@@ -31,9 +39,9 @@ export default defineEventHandler(async (event) => {
|
||||
console.log('[update-interest] Removed Id from update data');
|
||||
}
|
||||
|
||||
console.log('[update-interest] Updating interest:', id, 'with fields:', Object.keys(updateData));
|
||||
const updatedInterest = await updateInterest(id, updateData);
|
||||
console.log('[update-interest] Successfully updated interest:', id);
|
||||
console.log('[update-interest] Updating interest:', interestId, 'with fields:', Object.keys(updateData));
|
||||
const updatedInterest = await updateInterest(interestId, updateData);
|
||||
console.log('[update-interest] Successfully updated interest:', interestId);
|
||||
|
||||
return updatedInterest;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user