Setup fetch and wip fetchall route for getting companies.

This commit is contained in:
2026-01-26 18:14:28 -06:00
parent 7748e6171b
commit 24d0c066fd
6 changed files with 163 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import { connectWiseApi } from "../../constants";
import { Company } from "../../types/ConnectWiseTypes";
export const fetchCwCompanyById = async (
companyId: number,
): Promise<Company | null> => {
try {
const response = await connectWiseApi.get(
`/company/companies/${companyId}`,
);
return response.data;
} catch (error) {
console.error(
`Error fetching company with ID ${companyId}:`,
(error as any).response?.data || error,
);
return null;
}
};