api 경로 수정

This commit is contained in:
2025-04-23 11:56:26 +09:00
parent 0306ebc890
commit beac42d60c
6 changed files with 73 additions and 11 deletions
+2 -2
View File
@@ -112,7 +112,7 @@ const routes = [
component: ClubSubscriptionManagement,
meta: {
requiresAuth: true,
requiredRoles: ['모임장', '운영진']
requiredRoles: ['admin', '모임장', '운영진']
}
}
]
@@ -169,7 +169,7 @@ router.beforeEach(async (to, from, next) => {
}
// 클럽 구독 관리 페이지에 접근하려는 경우, 권한 확인
if (to.name === 'ClubSubscription' && (userClubRole !== '모임장' && userClubRole !== '운영진')) {
if (to.name === 'ClubSubscription' && (userClubRole !== 'admin' && userClubRole !== '모임장' && userClubRole !== '운영진')) {
next({ name: 'ClubDashboard' });
return;
}
+2 -1
View File
@@ -1,7 +1,8 @@
import axios from 'axios';
// 환경 변수에서 API URL을 가져오거나 기본값 사용
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3030';
// const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3030';
const API_URL = '';
// axios 인스턴스 생성
const apiClient = axios.create({
@@ -126,6 +126,8 @@ import { useRouter } from 'vue-router';
import apiClient from '@/services/api';
const router = useRouter();
// 전역 clubId
const clubId = ref(localStorage.getItem('clubId'));
const currentSubscription = ref(null);
const plans = ref([]);
const payments = ref([]);
@@ -158,7 +160,7 @@ const isFeatureActive = (featureId) => {
// 현재 구독 정보 로드
const loadCurrentSubscription = async () => {
try {
const response = await apiClient.get('/api/subscriptions/current');
const response = await apiClient.post('/api/subscriptions/current', { clubId: clubId.value });
currentSubscription.value = response.data;
} catch (error) {
console.error('구독 정보 로드 실패:', error);
@@ -178,7 +180,7 @@ const loadPlans = async () => {
// 결제 내역 로드
const loadPayments = async () => {
try {
const response = await apiClient.get('/api/subscriptions/payments');
const response = await apiClient.post('/api/subscriptions/payments', { clubId: clubId.value });
payments.value = response.data;
} catch (error) {
console.error('결제 내역 로드 실패:', error);
@@ -188,7 +190,7 @@ const loadPayments = async () => {
// 사용 가능한 기능 목록 로드
const loadAvailableFeatures = async () => {
try {
const response = await apiClient.get('/api/features/available');
const response = await apiClient.post('/api/features/available', { clubId: clubId.value });
availableFeatures.value = response.data.map(feature => ({
...feature,
selectedDuration: 1
@@ -201,7 +203,7 @@ const loadAvailableFeatures = async () => {
// 활성화된 기능 목록 로드
const loadActiveFeatures = async () => {
try {
const response = await apiClient.get('/api/features/active');
const response = await apiClient.post('/api/features/active', { clubId: clubId.value });
activeFeatures.value = response.data;
} catch (error) {
console.error('활성화된 기능 로드 실패:', error);
@@ -211,7 +213,7 @@ const loadActiveFeatures = async () => {
// 기능 구매 내역 로드
const loadFeaturePayments = async () => {
try {
const response = await apiClient.get('/api/features/payments');
const response = await apiClient.post('/api/features/payments', { clubId: clubId.value });
featurePayments.value = response.data;
} catch (error) {
console.error('기능 구매 내역 로드 실패:', error);