feat: add error messages to user pages

This commit is contained in:
Kentai Radiquum 2025-03-20 22:02:49 +05:00
parent f2f03df1a0
commit d16e4d14d4
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
10 changed files with 285 additions and 136 deletions

View file

@ -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",