Laravel-based OAuth/IAM service with Passport, Vue 3 frontend, and Docker Compose setup for local and production deployment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
17 lines
551 B
TypeScript
17 lines
551 B
TypeScript
import { ref } from 'vue';
|
|
|
|
// El estado inicial ya lo aplicó el script inline en app.blade.php (evita el
|
|
// flash); acá solo reflejamos esa clase para que el ícono del toggle arranque
|
|
// sincronizado.
|
|
const isDark = ref(document.documentElement.classList.contains('dark'));
|
|
|
|
function toggleTheme(): void {
|
|
isDark.value = !isDark.value;
|
|
document.documentElement.classList.toggle('dark', isDark.value);
|
|
localStorage.setItem('theme', isDark.value ? 'dark' : 'light');
|
|
}
|
|
|
|
export function useTheme() {
|
|
return { isDark, toggleTheme };
|
|
}
|