1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

не факт что заработает)

This commit is contained in:
1
2024-12-25 13:29:06 +06:00
parent ec177c9cce
commit 9fc51e9eac
3 changed files with 22 additions and 46 deletions

View File

@@ -5,8 +5,8 @@ services:
dockerfile: docker/frontend/Dockerfile
container_name: support-frontend
restart: unless-stopped
networks:
- app-network
depends_on:
- backend
backend:
build:
@@ -20,26 +20,20 @@ services:
volumes:
- ./backend:/app
- sqlite_data:/app/instance
networks:
- app-network
nginx:
build:
context: .
dockerfile: docker/nginx/Dockerfile
context: ./docker/nginx
dockerfile: Dockerfile
container_name: support-nginx
restart: unless-stopped
ports:
- "80:80"
- "80:80" # Вернем на стандартный порт 80
volumes:
- ./docker/nginx/conf.d:/etc/nginx/conf.d:ro
depends_on:
- frontend
- backend
networks:
- app-network
networks:
app-network:
driver: bridge
volumes:
sqlite_data:

View File

@@ -5,20 +5,7 @@ server {
root /usr/share/nginx/html;
index index.html;
# Основной маршрут для статических файлов
location / {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Маршрут для админ-панели
location /admin {
alias /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# API прокси
# Важно: этот блок должен быть перед location /
location /api/ {
proxy_pass http://backend:8000/api/;
proxy_http_version 1.1;
@@ -31,6 +18,11 @@ server {
proxy_read_timeout 60s;
}
# Обработка ошибок
error_page 404 /index.html;
}
# Обработка всех остальных маршрутов
location / {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}
}

View File

@@ -13,36 +13,26 @@ const router = createRouter({
{
path: '/support',
name: 'support',
// Ошибка: Не найден модуль '../views/SupportView.vue'
component: () => import('../views/SupportView.vue'),
meta: { requiresAuth: true }
},
{
path: '/admin',
name: 'admin-login',
// Ошибка: Не найден модуль '../views/admin/AdminLoginView.vue'
component: () => import('../views/admin/AdminLoginView.vue')
},
{
path: '/admin/dashboard',
name: 'admin-dashboard',
// Ошибка: Не найден модуль '../views/admin/DashboardView.vue'
component: () => import('../views/admin/DashboardView.vue'),
meta: { requiresAdmin: true }
},
// Добавим catch-all маршрут для 404
{
path: '/:pathMatch(.*)*',
redirect: '/'
}
]
});
router.beforeEach((to, _, next) => {
const authStore = useAuthStore();
if (to.meta.requiresAuth && !authStore.isAuthenticated) {
next({ name: 'login' });
} else if (to.meta.requiresAdmin && !authStore.isAdmin) {
next({ name: 'admin-login' });
} else {
next();
}
});
export default router;
// Остальной код router.ts остается без изменений