Ziya/app/composables/auth-guard.ts
rizary 6efcf43691
feat: complete ESLint configuration overhaul and theme system improvements
- Migrate from legacy .eslintrc.json to modern flat config system
- Remove conflicting ESLint configuration files
- Fix auto-generation of eslint.config.mjs by Nuxt
- Update ESLint rules to use single quotes and proper formatting
- Add comprehensive theme switching system with 24 palettes
- Implement proper daisyUI theme integration
- Add theme store with persistence and dark/light mode support
- Create ThemeSwitcher component with enhanced UI
- Fix package.json scripts to work with new ESLint flat config
- Update VS Code settings for proper ESLint integration
- Add changelogen scripts for proper changelog management

BREAKING CHANGE: ESLint configuration migrated to flat config system
2025-06-22 00:53:24 +07:00

25 lines
447 B
TypeScript

export const useAuthGuard = () => {
const appStore = useAppStore();
const router = useRouter();
const requireAuth = () => {
onMounted(() => {
if (!appStore.isAuthenticated) {
router.push('/login');
}
});
};
const requireGuest = () => {
onMounted(() => {
if (appStore.isAuthenticated) {
router.push('/dashboard');
}
});
};
return {
requireAuth,
requireGuest,
};
};