feat(account): implement user account page with skin upload

This commit is contained in:
2025-06-17 12:01:08 +03:00
parent d6059f4325
commit e391c16468
5 changed files with 235 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue"; // Мы создадим его позже
import HomeView from "../views/HomeView.vue";
const routes = [
{
@@ -10,7 +10,6 @@ const routes = [
{
path: "/login",
name: "login",
// Ленивая загрузка (lazy-loading) для страниц, которые не нужны сразу
component: () => import("../views/LoginView.vue"),
},
{
@@ -18,7 +17,12 @@ const routes = [
name: "register",
component: () => import("../views/RegisterView.vue"),
},
// Здесь будут другие роуты: личный кабинет, мониторинг и т.д.
{
path: "/account",
name: "account",
component: () => import("../views/AccountView.vue"),
meta: { requiresAuth: true },
},
];
const router = createRouter({
@@ -26,4 +30,12 @@ const router = createRouter({
routes,
});
router.beforeEach((to, from, next) => {
const authStore = useAuthStore();
if (to.meta.requiresAuth && !authStore.isAuthenticated) {
next({ name: "login" });
} else {
next();
}
});
export default router;