feat(share) : lien Documents conditionné à l'activation du partage

This commit is contained in:
Matthieu
2026-06-03 17:23:44 +02:00
parent 947d95b1f7
commit c125566efc
2 changed files with 40 additions and 2 deletions
+23
View File
@@ -0,0 +1,23 @@
import { useShareService } from '~/services/share'
export function useShareStatus() {
const enabled = useState<boolean | null>('share-enabled', () => null)
const { getStatus } = useShareService()
async function refresh() {
try {
const status = await getStatus()
enabled.value = status.enabled
} catch {
enabled.value = false
}
}
async function ensureLoaded() {
if (enabled.value === null) {
await refresh()
}
}
return { enabled, refresh, ensureLoaded }
}