Fix: Use correct safeStorage methods
The `safeStorage` object in `budgetUtils.ts` defines `get`, `set`, and `remove` methods, but the `budgetStorage.ts` file is using `getItem`, `setItem`, and `removeItem`. This commit updates `budgetStorage.ts` to use the correct methods from `safeStorage`.
This commit is contained in:
@@ -13,6 +13,39 @@ const PRESERVE_KEYS = [
|
||||
'supabase-auth',
|
||||
];
|
||||
|
||||
/**
|
||||
* 안전한 로컬 스토리지 작업을 위한 유틸리티 객체
|
||||
*/
|
||||
export const safeStorage = {
|
||||
setItem: (key: string, value: any) => {
|
||||
try {
|
||||
localStorage.setItem(key, JSON.stringify(value));
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error(`스토리지 저장 오류 (${key}):`, err);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
getItem: (key: string, defaultValue: any = null) => {
|
||||
try {
|
||||
const item = localStorage.getItem(key);
|
||||
return item ? JSON.parse(item) : defaultValue;
|
||||
} catch (err) {
|
||||
console.error(`스토리지 로드 오류 (${key}):`, err);
|
||||
return defaultValue;
|
||||
}
|
||||
},
|
||||
removeItem: (key: string) => {
|
||||
try {
|
||||
localStorage.removeItem(key);
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error(`스토리지 삭제 오류 (${key}):`, err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 모든 로컬 스토리지 데이터 초기화 (보존할 항목 제외)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user