15 lines
483 B
TypeScript
15 lines
483 B
TypeScript
import { ref, watch } from 'vue'
|
|
|
|
// Cr├®er une r├®f├®rence pour isAdminActive
|
|
const isAdminActive = ref(JSON.parse(localStorage.getItem('isAdminActive') || 'false'))
|
|
|
|
// Surveiller les changements de isAdminActive et mettre à jour localStorage
|
|
watch(isAdminActive, (newValue) => {
|
|
localStorage.setItem('isAdminActive', JSON.stringify(newValue))
|
|
})
|
|
|
|
// Exporter une fonction pour utiliser isAdminActive
|
|
export function useAdminMode() {
|
|
return { isAdminActive }
|
|
}
|