|
|
|
|
@ -2,10 +2,25 @@ import { Controller } from '@hotwired/stimulus';
@@ -2,10 +2,25 @@ import { Controller } from '@hotwired/stimulus';
|
|
|
|
|
import { getComponent } from '@symfony/ux-live-component'; |
|
|
|
|
|
|
|
|
|
export default class extends Controller { |
|
|
|
|
static targets = ['nostrError']; |
|
|
|
|
|
|
|
|
|
async initialize() { |
|
|
|
|
this.component = await getComponent(this.element); |
|
|
|
|
} |
|
|
|
|
async loginAct() { |
|
|
|
|
async loginAct(event) { |
|
|
|
|
if (!window.nostr) { |
|
|
|
|
if (this.hasNostrErrorTarget) { |
|
|
|
|
this.nostrErrorTarget.textContent = 'Extension is not available.'; |
|
|
|
|
this.nostrErrorTarget.style.display = 'block'; |
|
|
|
|
} |
|
|
|
|
event?.preventDefault(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (this.hasNostrErrorTarget) { |
|
|
|
|
this.nostrErrorTarget.textContent = ''; |
|
|
|
|
this.nostrErrorTarget.style.display = 'none'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const tags = [ |
|
|
|
|
['u', window.location.origin + '/login'], |
|
|
|
|
['method', 'POST'], |
|
|
|
|
@ -35,4 +50,3 @@ export default class extends Controller {
@@ -35,4 +50,3 @@ export default class extends Controller {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|