fix: make the last acl tag removable on machines
This commit is contained in:
parent
09e1b1f261
commit
6e55f442fd
2 changed files with 8 additions and 4 deletions
|
|
@ -3,6 +3,7 @@ import { ActionFunctionArgs, json } from '@remix-run/node'
|
|||
|
||||
import { del, post } from '~/utils/headscale'
|
||||
import { getSession } from '~/utils/sessions'
|
||||
import log from '~/utils/log'
|
||||
|
||||
export async function menuAction(request: ActionFunctionArgs['request']) {
|
||||
const session = await getSession(request.headers.get('Cookie'))
|
||||
|
|
@ -82,7 +83,9 @@ export async function menuAction(request: ActionFunctionArgs['request']) {
|
|||
|
||||
case 'tags': {
|
||||
const tags = data.get('tags')?.toString()
|
||||
.split(',') ?? []
|
||||
.split(',')
|
||||
.filter((tag) => tag.trim() !== '')
|
||||
?? []
|
||||
|
||||
try {
|
||||
await post(`v1/node/${id}/tags`, session.get('hsApiKey')!, {
|
||||
|
|
@ -90,7 +93,8 @@ export async function menuAction(request: ActionFunctionArgs['request']) {
|
|||
})
|
||||
|
||||
return json({ message: 'Tags updated' })
|
||||
} catch {
|
||||
} catch (error) {
|
||||
log.debug('APIC', 'Failed to update tags: %s', error)
|
||||
return json({ message: 'Failed to update tags' }, {
|
||||
status: 500,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue