Some checks failed
🚀 Deploy - Demo / deployment (push) Has been cancelled
- 웹훅 URL을 https://admin.youtooplay.com/webhook로 변경 - Nginx 리버스 프록시 설정 파일 추가 - 배포 가이드 업데이트
24 lines
637 B
TypeScript
24 lines
637 B
TypeScript
export default defineNuxtRouteMiddleware((to, from) => {
|
|
// 로그인 페이지와 회원가입 페이지는 인증 체크 제외
|
|
if (to.path === '/login' || to.path === '/register') {
|
|
return
|
|
}
|
|
|
|
// 서버 사이드에서는 쿠키로 체크
|
|
if (process.server) {
|
|
const token = useCookie('auth-token')
|
|
if (!token.value) {
|
|
return navigateTo('/login')
|
|
}
|
|
return
|
|
}
|
|
|
|
// 클라이언트 사이드에서는 쿠키와 localStorage 체크
|
|
const token = useCookie('auth-token')
|
|
|
|
// 토큰이 없으면 로그인 페이지로 리다이렉션
|
|
if (!token.value) {
|
|
return navigateTo('/login')
|
|
}
|
|
})
|