Skip to content

Commit 79be3b4

Browse files
resolved: elipsis comments
Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com>
1 parent 070cf98 commit 79be3b4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

nextjs/src/features/organization/helper/geoHelpers.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ export interface City {
2929
}
3030

3131
export const fetchCountries = async (): Promise<Country[]> => {
32-
const response = await getAllCountries()
33-
const { data } = response as AxiosResponse
34-
35-
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
36-
return data?.data || []
32+
try {
33+
const response = await getAllCountries()
34+
const { data } = response as AxiosResponse
35+
return data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS
36+
? data.data || []
37+
: []
38+
} catch (error) {
39+
console.error('Error fetching countries:', error)
40+
return []
3741
}
38-
throw new Error(data?.message || 'Failed to fetch countries')
3942
}
4043

4144
export const fetchStates = async (countryId: number): Promise<State[]> => {

0 commit comments

Comments
 (0)