diff --git a/src/router/profile.ts b/src/router/profile.ts index 0169583..8af0e19 100644 --- a/src/router/profile.ts +++ b/src/router/profile.ts @@ -1,3 +1,4 @@ +import apiClient from '@/api'; import { RouteRecordRaw } from 'vue-router'; export const profileRoutes: RouteRecordRaw[] = [ @@ -12,6 +13,16 @@ export const profileRoutes: RouteRecordRaw[] = [ { path: ':id(\\d+)', component: () => import('@/views/profile/ProfileView.vue'), + beforeEnter: async to => { + const { response } = await apiClient.GET('/auth/user/{user_id}', { + params: { path: { user_id: Number(to.params.id) } }, + }); + if (response.ok) { + return true; + } else { + return { path: '/error' }; + } + }, }, // Раскомментируйте, если починили; удалите, если решили дропнуть // { diff --git a/src/views/admin/AdminView.vue b/src/views/admin/AdminView.vue index 7d4058a..5360188 100644 --- a/src/views/admin/AdminView.vue +++ b/src/views/admin/AdminView.vue @@ -45,7 +45,7 @@ onMounted(() => {