feat: 프론트 인증 연동 (소셜 로그인 + Bearer 세션)
- 로그인 화면: 구글(GIS) 버튼 + 애플 버튼 + 개발용 로그인(local) - 인증 스토어(Pinia): 토큰 복구/로그인/로그아웃, 회원 티어를 광고·매칭 제어에 반영 - HTTP 클라이언트: Authorization Bearer 자동 첨부, 401 시 토큰 폐기 후 로그인 이동 - 라우터 가드: 미로그인 시 보호 경로 → /login (소셜 로그인 전용 앱) - 헤더 회원 메뉴/로그아웃, 체크인 주체를 로그인 회원으로 전환 - 토큰 localStorage 저장(웹/Capacitor 공용) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+15
-6
@@ -10,19 +10,28 @@ import 'quasar/src/css/index.sass'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import './css/app.scss'
|
||||
import { setUnauthorizedHandler } from '@/api/http'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
const pinia = createPinia()
|
||||
app.use(pinia)
|
||||
app.use(Quasar, {
|
||||
plugins: { Notify },
|
||||
config: {
|
||||
brand: {
|
||||
// quasar-variables.scss 와 일치 (런타임 참고용)
|
||||
primary: '#6DB3E8',
|
||||
},
|
||||
brand: { primary: '#6DB3E8' },
|
||||
},
|
||||
})
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
|
||||
app.mount('#app')
|
||||
// 401 응답 시 로그인 화면으로
|
||||
setUnauthorizedHandler(() => {
|
||||
if (router.currentRoute.value.name !== 'login') {
|
||||
router.replace({ name: 'login' })
|
||||
}
|
||||
})
|
||||
|
||||
// 저장된 토큰으로 세션 복구 후 마운트 (라우터 가드가 올바른 상태를 보도록)
|
||||
const auth = useAuthStore(pinia)
|
||||
auth.init().finally(() => app.mount('#app'))
|
||||
|
||||
Reference in New Issue
Block a user