Skip to content

Commit 3a21acf

Browse files
authored
Update jiffyApis.tsx
axios migrate
1 parent fa78077 commit 3a21acf

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/components/common/apiCalls/jiffyApis.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,23 +1123,28 @@ export const resolveBNSAddress = async (address: String, network: string): Promi
11231123
};
11241124

11251125

1126-
export const fetchData = async (item : ItemProps) => {
1127-
let data;
1126+
export const fetchData = async (item: ItemProps, Authorization: string) => {
1127+
let config = {
1128+
method: 'get',
1129+
maxBodyLength: Infinity,
1130+
url: `${API_URL}/v0/getUserOpLogs`,
1131+
params: {
1132+
userOpHash: item.userOpHash,
1133+
network: item.network,
1134+
},
1135+
headers: {
1136+
Authorization: Authorization,
1137+
'x-api-key': X_API_Key,
1138+
},
1139+
};
1140+
11281141
try {
1129-
const res = await fetch(`${API_URL}/v0/getUserOpLogs?userOpHash=${item.userOpHash}&network=${item.network}`, {
1130-
headers: {
1131-
'x-api-key': X_API_Key ?? '' ,
1132-
},
1133-
});
1134-
if (!res.ok) {
1135-
throw new Error(`HTTP error! status: ${res.status}`);
1136-
}
1137-
data = await res.json();
1142+
const response = await axios.request(config);
1143+
return response.data;
11381144
} catch (error) {
11391145
console.error("Error fetching data: ", error);
1140-
data = {}; //failed - empty logs
1146+
return {}; // failed - empty logs
11411147
}
1142-
return data;
11431148
};
11441149

11451150
export const fetchNetworkData = async (term: string): Promise<NetworkResponse[]> => {

0 commit comments

Comments
 (0)