feat(admin): 관리자 콘솔 — 소셜 로그인 + 회원관리 (사용자 인증과 분리)

- 관리자 전용 store(adminAuth)·API(adminAuth·adminMembers)로 사용자 auth와 분리, 공용 저수준(http·tokenStore)만 재사용
- 관리자 레이아웃(헤더+좌측 사이드메뉴+바디+풋터), 웹 전용
- 구글 로그인(GIS) + 개발자 로그인(dev, admin@dog.com) — /admin/login
- 회원관리 q-table: 검색·상태/구독/권한 인라인 변경·삭제, 본인 행 잠금
- 라우터 /admin 경로 + 별도 관리자 가드, http에 put/del 추가, 401 분기(관리자→admin-login), Dialog 등록

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-07-11 08:59:20 +09:00
parent 0c538e0658
commit 85c925008a
10 changed files with 634 additions and 5 deletions
+42
View File
@@ -1,6 +1,7 @@
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import MainLayout from '@/layouts/MainLayout.vue'
import { useAuthStore } from '@/stores/auth'
import { useAdminAuthStore } from '@/stores/adminAuth'
const routes: RouteRecordRaw[] = [
{
@@ -17,6 +18,25 @@ const routes: RouteRecordRaw[] = [
{ path: 'profile', name: 'profile', component: () => import('@/pages/ProfilePage.vue') },
],
},
// 관리자 콘솔 (웹 전용) — 사용자 앱과 분리
{
path: '/admin/login',
name: 'admin-login',
component: () => import('@/pages/admin/AdminLoginPage.vue'),
},
{
path: '/admin',
component: () => import('@/layouts/AdminLayout.vue'),
meta: { requiresAdmin: true },
children: [
{ path: '', redirect: { name: 'admin-members' } },
{
path: 'members',
name: 'admin-members',
component: () => import('@/pages/admin/AdminMembersPage.vue'),
},
],
},
]
const router = createRouter({
@@ -26,6 +46,10 @@ const router = createRouter({
// 소셜 로그인 전용 앱: 미로그인 시 보호 경로 접근 → 로그인으로
router.beforeEach((to) => {
// 관리자 경로는 아래 관리자 가드가 처리 (사용자 가드는 관여하지 않음)
if (to.matched.some((r) => r.meta.requiresAdmin) || to.name === 'admin-login') {
return true
}
const auth = useAuthStore()
if (to.meta.requiresAuth && !auth.isAuthenticated) {
return { name: 'login', query: { redirect: to.fullPath } }
@@ -35,4 +59,22 @@ router.beforeEach((to) => {
}
})
// 관리자 콘솔 가드 — 토큰/회원 복원 후 ADMIN 여부 확인 (사용자 인증과 분리)
router.beforeEach(async (to) => {
const needsAdmin = to.matched.some((r) => r.meta.requiresAdmin)
if (!needsAdmin && to.name !== 'admin-login') return true
const admin = useAdminAuthStore()
if (admin.hasToken() && !admin.member) {
await admin.fetchMe()
}
if (needsAdmin && !admin.isAdmin) {
return { name: 'admin-login' }
}
if (to.name === 'admin-login' && admin.isAdmin) {
return { name: 'admin-members' }
}
return true
})
export default router