- 웹훅 URL을 https://admin.youtooplay.com/webhook로 변경 - Nginx 리버스 프록시 설정 파일 추가 - 배포 가이드 업데이트
This commit is contained in:
23
middleware/auth.ts
Normal file
23
middleware/auth.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user