fix customer record
This commit is contained in:
@ -26,6 +26,7 @@ export default function ContactRecordList({ customerId }: ContactRecordListProps
|
|||||||
|
|
||||||
// Function to fetch contact records
|
// Function to fetch contact records
|
||||||
const fetchContactRecords = async () => {
|
const fetchContactRecords = async () => {
|
||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/api/contact-records?customerId=${customerId}`);
|
const response = await fetch(`/api/contact-records?customerId=${customerId}`);
|
||||||
@ -35,7 +36,7 @@ export default function ContactRecordList({ customerId }: ContactRecordListProps
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setContactRecords(data);
|
setContactRecords(data.data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err instanceof Error ? err.message : 'An error occurred while fetching contact records');
|
setError(err instanceof Error ? err.message : 'An error occurred while fetching contact records');
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export async function GET(request: NextRequest) {
|
|||||||
const dataSource = await getDataSource();
|
const dataSource = await getDataSource();
|
||||||
const contactRecordRepository = dataSource.getRepository(ContactRecord);
|
const contactRecordRepository = dataSource.getRepository(ContactRecord);
|
||||||
|
|
||||||
|
|
||||||
// Get query parameters
|
// Get query parameters
|
||||||
const url = new URL(request.url);
|
const url = new URL(request.url);
|
||||||
const customerId = url.searchParams.get('customerId');
|
const customerId = url.searchParams.get('customerId');
|
||||||
|
|||||||
Reference in New Issue
Block a user