feat: enhance error handling and improve API response management across components
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m39s

This commit is contained in:
2025-04-14 01:05:07 +05:00
parent 0d578c9add
commit 6365a701ba
11 changed files with 111 additions and 66 deletions

View File

@ -40,8 +40,11 @@ export async function DevicesTable({
getDevices({ query: query, limit: limit, offset: offset }),
);
if (error) {
if (error.message === "Invalid token.") redirect("/auth/signin");
return <ClientErrorMessage message={error.message} />;
if (error.message === "UNAUTHORIZED") {
redirect("/auth/signin");
} else {
return <ClientErrorMessage message={error.message} />;
}
}
const { meta, data } = devices;
return (
@ -77,7 +80,7 @@ export async function DevicesTable({
<TableCell colSpan={2}>
{query?.length > 0 && (
<p className="text-sm text-muted-foreground">
Showing {meta?.total} locations for &quot;{query}
Showing {meta?.total} devices for &quot;{query}
&quot;
</p>
)}