Implement error handling and loading states for Appwrite integration
This commit is contained in:
@@ -11,22 +11,40 @@ export interface AppwriteConfig {
|
||||
projectId: string;
|
||||
databaseId: string;
|
||||
transactionsCollectionId: string;
|
||||
apiKey: string;
|
||||
}
|
||||
|
||||
// 환경 변수에서 설정 값 가져오기
|
||||
const endpoint = import.meta.env.VITE_APPWRITE_ENDPOINT || 'https://a11.ism.kr/v1';
|
||||
const projectId = import.meta.env.VITE_APPWRITE_PROJECT_ID || 'zellyy-finance';
|
||||
const databaseId = import.meta.env.VITE_APPWRITE_DATABASE_ID || 'zellyy-finance';
|
||||
const projectId = import.meta.env.VITE_APPWRITE_PROJECT_ID || '68182a300039f6d700a6';
|
||||
const databaseId = import.meta.env.VITE_APPWRITE_DATABASE_ID || 'default';
|
||||
const transactionsCollectionId = import.meta.env.VITE_APPWRITE_TRANSACTIONS_COLLECTION_ID || 'transactions';
|
||||
const apiKey = import.meta.env.VITE_APPWRITE_API_KEY || '';
|
||||
|
||||
// 개발 모드에서 설정 값 로깅
|
||||
console.log('현재 Appwrite 설정:', {
|
||||
endpoint,
|
||||
projectId,
|
||||
databaseId,
|
||||
transactionsCollectionId,
|
||||
apiKey: apiKey ? '설정됨' : '설정되지 않음' // API 키는 안전을 위해 완전한 값을 로깅하지 않음
|
||||
});
|
||||
|
||||
// 설정 객체 생성
|
||||
export const config: AppwriteConfig = {
|
||||
endpoint,
|
||||
projectId,
|
||||
databaseId,
|
||||
transactionsCollectionId
|
||||
transactionsCollectionId,
|
||||
apiKey,
|
||||
};
|
||||
|
||||
// Getter functions for config values
|
||||
export const getAppwriteEndpoint = (): string => endpoint;
|
||||
export const getAppwriteProjectId = (): string => projectId;
|
||||
export const getAppwriteDatabaseId = (): string => databaseId;
|
||||
export const getAppwriteTransactionsCollectionId = (): string => transactionsCollectionId;
|
||||
|
||||
/**
|
||||
* 서버 연결 유효성 검사
|
||||
* @returns 유효한 설정인지 여부
|
||||
|
||||
Reference in New Issue
Block a user