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:
AmirReza Jamali
2026-04-13 08:16:21 +03:30
parent 50db71843b
commit 76cb29d31e
3 changed files with 20 additions and 8 deletions
+1
View File
@@ -110,3 +110,4 @@ export const deleteEmptyKeys = (obj: Record<string, any>) => {
}
return newObj;
};
export const isValidAlpha2CountryCode = (code: string) => /^[A-Za-z]{2}$/.test(code);