[로딩 시스템 추가] 전역 로딩 오버레이 및 상태 관리 스토어 구현, 로딩 카운터 방식으로 비동기 작업 관리 기능 추가
This commit is contained in:
@@ -13,14 +13,11 @@ export const usePermissionsStore = defineStore(
|
||||
},
|
||||
});
|
||||
|
||||
// 권한 로딩 상태
|
||||
const isLoading = ref(false);
|
||||
|
||||
// 서버에서 권한 데이터 가져오기 (현재는 가데이터 사용)
|
||||
const fetchPermissions = async (): Promise<boolean> => {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
const { withLoading } = useLoading();
|
||||
|
||||
return await withLoading(async () => {
|
||||
// 실제 API 호출 (백엔드 준비되면 주석 해제)
|
||||
/*
|
||||
const { success, data } = await useApi<UserPermissions>('/auth/permissions', {
|
||||
@@ -53,12 +50,7 @@ export const usePermissionsStore = defineStore(
|
||||
};
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error("권한 데이터 로드 실패:", error);
|
||||
return false;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}, "권한 정보를 불러오는 중...");
|
||||
};
|
||||
|
||||
const getPagePaths = (): string[] => {
|
||||
@@ -104,7 +96,6 @@ export const usePermissionsStore = defineStore(
|
||||
|
||||
return {
|
||||
permissions: readonly(permissions),
|
||||
isLoading: readonly(isLoading),
|
||||
|
||||
fetchPermissions,
|
||||
clearPermissions,
|
||||
|
||||
Reference in New Issue
Block a user