This commit is contained in:
2025-04-17 23:32:39 +09:00
commit 5b719b6766
105 changed files with 25653 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
import { defineStore } from 'pinia';
import axios from 'axios';
export const useAdminStore = defineStore('admin', {
state: () => ({
users: [],
clubs: [],
subscriptions: [],
loading: false,
error: null
}),
actions: {
async fetchUsers() {
try {
this.loading = true;
const response = await axios.get('/api/admin/users', {
headers: {
Authorization: `Bearer ${localStorage.getItem('token')}`
}
});
this.users = response.data;
} catch (error) {
this.error = error.response?.data?.message || '사용자 목록을 불러오는데 실패했습니다.';
throw error;
} finally {
this.loading = false;
}
},
async fetchClubs() {
try {
this.loading = true;
const response = await axios.get('/api/admin/clubs', {
headers: {
Authorization: `Bearer ${localStorage.getItem('token')}`
}
});
this.clubs = response.data;
} catch (error) {
this.error = error.response?.data?.message || '클럽 목록을 불러오는데 실패했습니다.';
throw error;
} finally {
this.loading = false;
}
},
async fetchSubscriptions() {
try {
this.loading = true;
const response = await axios.get('/api/admin/subscriptions', {
headers: {
Authorization: `Bearer ${localStorage.getItem('token')}`
}
});
this.subscriptions = response.data;
} catch (error) {
this.error = error.response?.data?.message || '구독 정보를 불러오는데 실패했습니다.';
throw error;
} finally {
this.loading = false;
}
}
}
});