Files
akkounts/app/javascript/controllers/nostr_signer_status_controller.js
raucao 70faa4f329 Update the signer section in place instead of reloading the page
Disconnecting, cancelling and (when a key already exists) connecting now swap the Nostr Connect section via Turbo Streams, so the page's relay/profile/media lookups are not re-fetched. A replace still reloads because it changes the key, and a first-time connect reloads to reveal the pubkey and metadata.
2026-11-28 13:42:38 +04:00

13 lines
452 B
JavaScript

import { Controller } from "@hotwired/stimulus"
// Mirrors the signer section's connection state onto the document, so the
// `data-remote-signer` flag stays correct when the section is replaced in place
// (turbo stream) instead of via a full page load.
export default class extends Controller {
static values = { connected: Boolean }
connect () {
document.documentElement.dataset.remoteSigner = this.connectedValue ? "true" : "false"
}
}