feature: Simulation Control Center (Dashboard)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { computed } from 'vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useSimulationStore } from '@/stores/simulation'
|
||||
|
||||
/**
|
||||
* Feature-detects in-app simulation via GET /api/v1/simulation/config.
|
||||
* Fail-closed: any error leaves simulationStore.enabled = false.
|
||||
*/
|
||||
export function useSimulationAvailable() {
|
||||
const auth = useAuthStore()
|
||||
const simulation = useSimulationStore()
|
||||
|
||||
const available = computed(() => simulation.enabled)
|
||||
|
||||
async function detect() {
|
||||
if (!auth.isAuthenticated) {
|
||||
simulation.enabled = false
|
||||
return false
|
||||
}
|
||||
await simulation.loadConfig()
|
||||
return simulation.enabled
|
||||
}
|
||||
|
||||
return { available, detect }
|
||||
}
|
||||
Reference in New Issue
Block a user