device: add copyToClipboard and fix regenerate token HTMX button
Phase 3: Complete device page functionality fixes - Add copyToClipboard function to device-management.ts: - Uses navigator.clipboard.writeText() for copying - Shows success/error toast notifications - Already exported in Alpine.store, now properly defined - Fix typo in devices.templ: change 'regerate-token' to 'regenerate-token' - Add HTMX support to RegenerateDeviceToken handler: - Returns HTML with reload script for HTMX requests - Preserves JSON response for API calls The regenerate token button now works via HTMX (hx-put) instead of Alpine.js, matching the pattern used elsewhere in the app.
This commit is contained in:
@@ -148,7 +148,8 @@ templ Devices(user User, devices []handlers.DeviceInfo, pendingRegistrations []P
|
||||
}
|
||||
<!-- Regenerate Token Button -->
|
||||
<button
|
||||
@click="regenerateDeviceToken('{ device.ID }', $event)"
|
||||
hx-put={ "/api/devices/" + device.ID.String() + "/regenerate-token" }
|
||||
hx-confirm="⚠️ Old token will immediately stop working. Regenerate anyway?"
|
||||
class="w-full px-3 py-2 text-xs rounded border hover:opacity-80"
|
||||
style="border-color: var(--border); color: var(--text-secondary); background-color: var(--bg-primary);"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user