diff --git a/client/src/App.tsx b/client/src/App.tsx
index d5427c9..012f516 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -1,5 +1,4 @@
-import { Admin, Authenticated, CustomRoutes, Resource } from 'react-admin';
-import { Route } from 'react-router-dom';
+import { Admin, Resource } from 'react-admin';
import { authProvider } from './auth/authProvider';
import { dataProvider } from './dataProvider';
import { EmbeddedActiveEquipmentPage } from './pages/EmbeddedActiveEquipmentPage';
@@ -13,18 +12,12 @@ import { EquipmentStatusChangeList } from './resources/equipment-status-change/E
import { EquipmentStatusChangeShow } from './resources/equipment-status-change/EquipmentStatusChangeShow';
function App() {
+ if (window.location.pathname === '/embedded/equipment-active') {
+ return ;
+ }
+
return (
-
-
-
-
- }
- />
-
('equipment', {
- pagination: { page: 1, perPage: 100 },
- sort: { field: 'name', order: 'ASC' },
- filter: { status: ['Active'] },
- });
+ const [data, setData] = useState([]);
+ const [total, setTotal] = useState(null);
+ const [isPending, setIsPending] = useState(true);
+ const [error, setError] = useState(null);
+
+ useEffect(() => {
+ let cancelled = false;
+
+ const load = async () => {
+ setIsPending(true);
+ setError(null);
+
+ try {
+ await ensureFreshToken();
+
+ const token = getAccessToken();
+ const headers = new Headers({
+ Accept: 'application/json',
+ });
+
+ if (token) {
+ headers.set('Authorization', `Bearer ${token}`);
+ }
+
+ const query = new URLSearchParams({
+ _start: '0',
+ _end: '100',
+ _sort: 'name',
+ _order: 'ASC',
+ });
+ query.append('status', 'Active');
+
+ const response = await fetch(`${env.apiUrl}/equipment?${query.toString()}`, {
+ headers,
+ });
+
+ if (!response.ok) {
+ const requestError = new Error(`Request failed with status ${response.status}`) as Error & {
+ status?: number;
+ };
+ requestError.status = response.status;
+ throw requestError;
+ }
+
+ const payload = (await response.json()) as EquipmentRecord[];
+ const contentRange = response.headers.get('Content-Range');
+ const parsedTotal = contentRange?.match(/\/(\d+)$/)?.[1];
+
+ if (!cancelled) {
+ setData(payload);
+ setTotal(parsedTotal ? Number(parsedTotal) : payload.length);
+ }
+ } catch (caughtError) {
+ if (!cancelled) {
+ setError(caughtError instanceof Error ? caughtError : new Error('Unknown error'));
+ }
+ } finally {
+ if (!cancelled) {
+ setIsPending(false);
+ }
+ }
+ };
+
+ void load();
+
+ return () => {
+ cancelled = true;
+ };
+ }, []);
return (