-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor LpLock component to improve destination details handling and…
… add error handling in light client interactions
- Loading branch information
Showing
4 changed files
with
71 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import axios from 'axios'; | ||
import { NextApiRequest, NextApiResponse } from 'next' | ||
|
||
export default async function handler(req: NextApiRequest, res: NextApiResponse) { | ||
const slug = req.query.slug && (req.query.slug as string[]).join('/'); | ||
|
||
const queryParams = {} | ||
for(const key in req.query) { | ||
if(key !== 'slug') { | ||
queryParams[key] = req.query[key] | ||
} | ||
} | ||
|
||
const searchParams = new URLSearchParams(queryParams); | ||
|
||
const rpcRes = await axios.get(`http://unstable.sepolia.beacon-api.nimbus.team/${slug}${searchParams ? `?${searchParams.toString()}` : ''}`) | ||
|
||
if (!rpcRes) { | ||
res.status(400).json({ error: { message: "Failed" } }) | ||
return | ||
} else if (rpcRes) { | ||
res.status(200).json(rpcRes.data) | ||
return | ||
} | ||
|
||
else { | ||
res.status(500) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters