Skip to content

Commit

Permalink
fix: add logging and fix dest
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Dec 7, 2023
1 parent 18c249d commit 1b4d81d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/client/src/app/status/statusPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const StatusPage = (): JSX.Element => {
const cancel = new AbortController();
const timer = setTimeout(() => cancel.abort(), 5000);
try {
await fetch('/api/device/delete', { method: 'DELETE', signal: cancel.signal });
await fetch('/api/device', { method: 'DELETE', signal: cancel.signal });
} catch (e) {
console.error(e);
} finally {
Expand Down
2 changes: 2 additions & 0 deletions packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ const routes = async (fastifyInstance: FastifyInstance) => {
});

fastifyInstance.delete('/api/device', async (request, reply) => {
log.info('Received delete all devices request');
const deviceIds = Object.keys(controlConnections);
let deleted = 0;
for (const deviceId of deviceIds) {
Expand All @@ -475,6 +476,7 @@ const routes = async (fastifyInstance: FastifyInstance) => {
deleted++;
}
}
log.info(`Deleted ${deleted} devices`);
return reply.code(200).send({ status: 'ok', error: `Deleted ${deleted} devices` });
});

Expand Down

0 comments on commit 1b4d81d

Please sign in to comment.