refactor(TenderDetails): enhance country flag handling and validation
- Updated the TenderDetails component to validate country codes using a new utility function, isValidAlpha2CountryCode. - Modified the useGetFlagQuery hook to accept an options parameter for conditional fetching based on the validity of the country code. - Improved the rendering logic for the country flag to ensure it only displays when valid flag data is available.
This commit is contained in:
@@ -110,3 +110,4 @@ export const deleteEmptyKeys = (obj: Record<string, any>) => {
|
||||
}
|
||||
return newObj;
|
||||
};
|
||||
export const isValidAlpha2CountryCode = (code: string) => /^[A-Za-z]{2}$/.test(code);
|
||||
Reference in New Issue
Block a user