Instant ai assistant toggle

This commit is contained in:
Emil
2026-02-21 17:28:54 +01:00
parent fa5e14de83
commit f5c9ebaf95
5 changed files with 47 additions and 14 deletions
+5
View File
@@ -62,6 +62,11 @@ export function useExtensionToggle(sectorSlug: string, extensionSlug: string) {
})
if (!res.ok) {
setEnabled(!newValue) // Revert on error
} else {
// Notify other components about the toggle change
window.dispatchEvent(new CustomEvent('extension-toggle-changed', {
detail: { sectorSlug, extensionSlug, enabled: newValue },
}))
}
} catch {
setEnabled(!newValue) // Revert on error