mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-30 09:59:41 +05:00
feat: add error messages to user pages
This commit is contained in:
parent
f2f03df1a0
commit
d16e4d14d4
10 changed files with 285 additions and 136 deletions
|
@ -18,10 +18,13 @@ export default async function middleware(
|
|||
}
|
||||
let path = url.pathname.match(/\/api\/proxy\/(.*)/)?.[1] + url.search;
|
||||
|
||||
const data = await fetchDataViaGet(`${API_URL}/${path}`, isApiV2);
|
||||
const { data, error } = await fetchDataViaGet(
|
||||
`${API_URL}/${path}`,
|
||||
isApiV2
|
||||
);
|
||||
|
||||
if (!data) {
|
||||
return new Response(JSON.stringify({ message: "Error Fetching Data" }), {
|
||||
if (error) {
|
||||
return new Response(JSON.stringify(error), {
|
||||
status: 500,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue