mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 11:08:12 +00:00
- Added new fields to the Company entity: licenceNumber, statusDescription, dateRegistered, renewedFrom, renewalDate, renewedTo, region, zone, woreda, kebele, houseNo, and etradePhone. - Updated onboarding wizard to include a new contact step and fetch company information from eTrade using TIN. - Created ETradeInfo component to handle fetching and displaying eTrade data. - Implemented ETradeService to interact with eTrade API and extract relevant company registration data. - Added new DTOs for fetching eTrade data and handling responses. - Updated CompanyProfileForm to integrate new fields and handle eTrade data. - Created hooks for managing eTrade data fetching and error handling.
17 lines
567 B
TypeScript
17 lines
567 B
TypeScript
import { useMutation } from "@tanstack/react-query";
|
|
import { companiesService } from "@/services/companies.service";
|
|
import { extractApiError } from "@/utils/result";
|
|
import type { CompanyRegistrationData } from "@edr/types";
|
|
|
|
export function useETradeData() {
|
|
return useMutation({
|
|
mutationFn: async (tin: string): Promise<CompanyRegistrationData> => {
|
|
return companiesService.fetchETradeInfo({ tin });
|
|
},
|
|
onError: (error) => {
|
|
const { message } = extractApiError(error);
|
|
console.error("eTrade fetch error:", message);
|
|
},
|
|
});
|
|
}
|