fix customer record
This commit is contained in:
@ -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 {
|
||||
|
||||
@ -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');
|
||||
|
||||
Reference in New Issue
Block a user