Website Structure

This commit is contained in:
supalerk-ar66 2026-01-13 10:46:40 +07:00
parent 62812f2090
commit 71f0676a62
22365 changed files with 4265753 additions and 791 deletions

View file

@ -0,0 +1,37 @@
// Shared global state for current user
const currentUser = ref({
prefix: 'นาย',
firstName: 'สมชาย',
lastName: 'ใจดี',
email: 'student@example.com',
photoURL: '' // Set to URL if available
})
export const useAuth = () => {
const token = useCookie('auth_token', {
maxAge: 60 * 60 * 24 * 7, // 1 week
sameSite: 'lax',
secure: process.env.NODE_ENV === 'production'
})
const isAuthenticated = computed(() => !!token.value)
const login = (mockToken: string = 'demo-token') => {
token.value = mockToken
}
const logout = () => {
token.value = null
// Reset user photo if needed on logout
// currentUser.value.photoURL = ''
return navigateTo('/auth/login', { replace: true })
}
return {
isAuthenticated,
token,
currentUser,
login,
logout
}
}