결제 수정

This commit is contained in:
2025-05-27 00:18:59 +09:00
parent 666d39704b
commit 27fbf0541d
5 changed files with 47 additions and 9 deletions
+10 -3
View File
@@ -130,7 +130,7 @@ const ownerName = ref('');
const isRouterReady = ref(false);
const userRole = computed(() => user.value?.role || '');
const isAdmin = computed(() => userRole.value === 'admin' || userRole.value === 'superadmin');
const userClubRole = ref(localStorage.getItem('userClubRole') || '');
const userClubRole = computed(() => localStorage.getItem('userClubRole') || '');
// 화면 크기 변경 감지
const handleResize = () => {
@@ -187,14 +187,20 @@ const fetchClubs = async () => {
...club,
memberType: club.memberType || ''
}));
// 첫 번째 클럽의 memberType을 localStorage에 저장
if (clubs.value.length > 0 && !selectedClubId.value) {
if ((clubs.value.length > 0 && !selectedClubId.value) || clubs.value.length === 1) {
selectedClubId.value = clubs.value[0].id;
await setSelectedClub(clubs.value[0]);
}
} catch (error) {
console.error('클럽 목록 로드 실패:', error);
// 클럽 목록을 가져오지 못했거나 클럽이 없는 경우
const userRole = localStorage.getItem('userRole');
// 관리자가 아닌 경우에만 클럽 생성 페이지로 리다이렉트
if (userRole !== 'admin' && userRole !== 'superadmin') {
router.push('/club/create');
}
}
};
@@ -341,6 +347,7 @@ const loadUserData = async () => {
try {
const response = await authService.getCurrentUser();
user.value = response.data;
localStorage.setItem('userRole', response.data.role);
} catch (error) {
console.error('사용자 정보 로드 실패:', error);
}