refactor: use custom axios instance and add try/catch
This commit is contained in:
parent
4f4cebb721
commit
6604fdfad2
|
@ -14,6 +14,9 @@ const sites = JSON.parse(
|
||||||
) as SiteList;
|
) as SiteList;
|
||||||
|
|
||||||
const client = new S5Client("https://s5.web3portal.com");
|
const client = new S5Client("https://s5.web3portal.com");
|
||||||
|
const httpClient = axios.create({
|
||||||
|
baseURL: "http://localhost",
|
||||||
|
});
|
||||||
|
|
||||||
for (const siteName in sites) {
|
for (const siteName in sites) {
|
||||||
const site = sites[siteName];
|
const site = sites[siteName];
|
||||||
|
@ -22,9 +25,11 @@ for (const siteName in sites) {
|
||||||
sub.listen((entry) => {
|
sub.listen((entry) => {
|
||||||
const cid = CID.fromRegistry(entry.data);
|
const cid = CID.fromRegistry(entry.data);
|
||||||
|
|
||||||
axios.post("http://localhost/api/events/siteUpdateReceived", {
|
try {
|
||||||
|
httpClient.post("/api/events/siteUpdateReceived", {
|
||||||
cid: cid.toString(),
|
cid: cid.toString(),
|
||||||
site: siteName,
|
site: siteName,
|
||||||
});
|
});
|
||||||
|
} catch {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue