diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/common.ts | 4 | ||||
| -rw-r--r-- | src/utils/friends.ts | 7 | ||||
| -rw-r--r-- | src/utils/hooks.ts | 6 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/utils/common.ts b/src/utils/common.ts index 7ae36dc6..cec0e1b5 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -73,8 +73,8 @@ export const moveCategory: ( }; export const checkImageUploadStatus = (statusMap: object) => { - for (let [key, value] of Object.entries(statusMap)) { - if (value != 'Success') { + for (const value of Object.values(statusMap)) { + if (value !== 'Success') { return false; } } diff --git a/src/utils/friends.ts b/src/utils/friends.ts index 5b0ded8f..93d9e054 100644 --- a/src/utils/friends.ts +++ b/src/utils/friends.ts @@ -1,7 +1,12 @@ // Handles click on friend/requested/unfriend button import {RootState} from '../store/rootReducer'; -import {ProfilePreviewType, ProfileInfoType, ScreenType, UserType} from '../types'; +import { + ProfilePreviewType, + ProfileInfoType, + ScreenType, + UserType, +} from '../types'; import {AppDispatch} from '../store/configureStore'; import { addFriend, diff --git a/src/utils/hooks.ts b/src/utils/hooks.ts index 3914ef48..336ac26c 100644 --- a/src/utils/hooks.ts +++ b/src/utils/hooks.ts @@ -4,10 +4,10 @@ import {useEffect, useState} from 'react'; export const useAsyncStorage = (key: string, defaultValue: string) => { const [storedValue, setStoredValue] = useState<string>(defaultValue); - const getStoredItem = async (key: string, defaultValue: string) => { + const getStoredItem = async (currentKey: string, currentValue: string) => { try { - const item = await AsyncStorage.getItem(key); - const value = item ? item : defaultValue; + const item = await AsyncStorage.getItem(currentKey); + const value = item ? item : currentValue; setStoredValue(value); } catch (error) { console.log(error); |
