fix customer record

This commit is contained in:
Ken Yasue
2025-03-25 13:51:47 +01:00
parent b512aef63d
commit c4439e779f
2 changed files with 3 additions and 1 deletions

View File

@ -26,6 +26,7 @@ export default function ContactRecordList({ customerId }: ContactRecordListProps
// Function to fetch contact records
const fetchContactRecords = async () => {
setIsLoading(true);
try {
const response = await fetch(`/api/contact-records?customerId=${customerId}`);
@ -35,7 +36,7 @@ export default function ContactRecordList({ customerId }: ContactRecordListProps
}
const data = await response.json();
setContactRecords(data);
setContactRecords(data.data);
} catch (err) {
setError(err instanceof Error ? err.message : 'An error occurred while fetching contact records');
} finally {

View File

@ -7,6 +7,7 @@ export async function GET(request: NextRequest) {
const dataSource = await getDataSource();
const contactRecordRepository = dataSource.getRepository(ContactRecord);
// Get query parameters
const url = new URL(request.url);
const customerId = url.searchParams.get('customerId');