feat(TALE-10): edit machine owner via dropdown

This commit is contained in:
Aarnav Tale 2024-06-23 17:25:33 -04:00
parent ddd20fe027
commit d71e55d7af
No known key found for this signature in database
6 changed files with 170 additions and 13 deletions

View file

@ -61,6 +61,25 @@ export async function menuAction(request: ActionFunctionArgs['request']) {
return json({ message: 'Route updated' })
}
case 'move': {
if (!data.has('to')) {
return json({ message: 'No destination provided' }, {
status: 400,
})
}
const to = String(data.get('to'))
try {
await post(`v1/node/${id}/user?user=${to}`, session.get('hsApiKey')!)
return json({ message: `Moved node ${id} to ${to}` })
} catch {
return json({ message: `Failed to move node ${id} to ${to}` }, {
status: 500,
})
}
}
default: {
return json({ message: 'Invalid method' }, {
status: 400,