Skip to content

Commit 8b73135

Browse files
committed
lint and remove json(
1 parent e6c58aa commit 8b73135

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

app/routes/devices.$id.hardware.$hardware_name.calibrate.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createClient } from "@hey-api/client-fetch";
22
import { toast as notify } from "react-toastify";
3-
import { ActionFunctionArgs, LoaderFunctionArgs, json } from "@remix-run/node";
3+
import { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
44
import {
55
Link,
66
useActionData,
@@ -104,7 +104,7 @@ export async function action({ request }: ActionFunctionArgs) {
104104
client: evolverClient,
105105
},
106106
);
107-
return json(procedureState.data);
107+
return procedureState.data;
108108
} catch (error) {
109109
return submission.reply({ formErrors: ["unable to dispatch action"] });
110110
}
@@ -121,7 +121,7 @@ export async function action({ request }: ActionFunctionArgs) {
121121
client: evolverClient,
122122
},
123123
);
124-
return json(procedureState.data);
124+
return procedureState.data;
125125
} catch (error) {
126126
return submission.reply({
127127
formErrors: ["unable to start calibration"],
@@ -138,7 +138,7 @@ export async function action({ request }: ActionFunctionArgs) {
138138
client: evolverClient,
139139
},
140140
);
141-
return json(procedureState.data);
141+
return procedureState.data;
142142
} catch (error) {
143143
return submission.reply({ formErrors: ["unable to dispatch action"] });
144144
}
@@ -150,10 +150,7 @@ export async function action({ request }: ActionFunctionArgs) {
150150
export async function loader({ params }: LoaderFunctionArgs) {
151151
const { id, hardware_name } = params;
152152
const targetDevice = await db.device.findUnique({ where: { device_id: id } });
153-
if (!targetDevice) {
154-
return json({ actions: [] });
155-
}
156-
const { url } = targetDevice;
153+
const { url } = targetDevice ?? { url: "" };
157154
const evolverClient = createClient({
158155
baseUrl: url,
159156
});
@@ -177,10 +174,10 @@ export async function loader({ params }: LoaderFunctionArgs) {
177174
},
178175
);
179176

180-
return json({
177+
return {
181178
actions: procedureActions?.actions,
182179
state: procedureState,
183-
});
180+
};
184181
}
185182

186183
const CalibrationProcedure = ({ actions, state }) => {
@@ -363,8 +360,6 @@ export function ErrorBoundary() {
363360

364361
export default function CalibrateHardware() {
365362
const { actions, state } = useLoaderData<typeof loader>();
366-
const { id, hardware_name }: { id: string; hardware_name: string } =
367-
useParams();
368363

369364
const actionData = useActionData<typeof action>();
370365

0 commit comments

Comments
 (0)