storage.ts (b50427a2113c3b0d9efb6cb4e9cb65a118ae9bda) storage.ts (cf2d630eca034addcb92030a5268105bce30ef82)
1import {errorLog} from '@/utils/log';
2import AsyncStorage from '@react-native-async-storage/async-storage';
3
4export async function setStorage(key: string, value: any) {
5 try {
1import {errorLog} from '@/utils/log';
2import AsyncStorage from '@react-native-async-storage/async-storage';
3
4export async function setStorage(key: string, value: any) {
5 try {
6 console.log('KEY', key, 'VALUE', JSON.stringify(value, null, ''));
7 await AsyncStorage.setItem(key, JSON.stringify(value, null, ''));
8 } catch (e: any) {
9 errorLog(`存储失败${key}`, e?.message);
6 await AsyncStorage.setItem(key, JSON.stringify(value, null, ''));
7 } catch (e: any) {
8 errorLog(`存储失败${key}`, e?.message);
10 console.log('????', key, e);
11 }
12}
13
14export async function getStorage(key: string) {
15 try {
16 const result = await AsyncStorage.getItem(key);
17 if (result) {
18 return JSON.parse(result);

--- 26 unchanged lines hidden ---
9 }
10}
11
12export async function getStorage(key: string) {
13 try {
14 const result = await AsyncStorage.getItem(key);
15 if (result) {
16 return JSON.parse(result);

--- 26 unchanged lines hidden ---