diff options
Diffstat (limited to 'src/utils/search.ts')
-rw-r--r-- | src/utils/search.ts | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/utils/search.ts b/src/utils/search.ts index 4293ff25..26f40b1b 100644 --- a/src/utils/search.ts +++ b/src/utils/search.ts @@ -1,14 +1,18 @@ import AsyncStorage from '@react-native-community/async-storage'; import {BADGE_DATA} from '../constants/badges'; -import {ProfilePreviewType, CategoryPreviewType} from '../types'; +import { + ProfilePreviewType, + CategoryPreviewType, + UniversityType, +} from '../types'; /* * Gets all possible search suggestions. */ -export const getSearchSuggestions = (): string[] => { +export const getSearchSuggestions = (university: UniversityType): string[] => { const suggestions: string[] = []; - for (const category of BADGE_DATA) { + for (const category of BADGE_DATA[university]) { for (const interest of category.data) { suggestions.push(interest.badgeName); } @@ -62,7 +66,9 @@ export const getRecentlySearchedUsers = async (): Promise< > => { try { const usersJSON = await AsyncStorage.getItem(recentlySearchedUsersKey); - if (usersJSON) return JSON.parse(usersJSON); + if (usersJSON) { + return JSON.parse(usersJSON); + } } catch (e) { console.log(e); } @@ -124,7 +130,9 @@ export const getRecentlySearchedCategories = async (): Promise< const categoriesJSON = await AsyncStorage.getItem( '@recently_searched_categories', ); - if (categoriesJSON) return JSON.parse(categoriesJSON); + if (categoriesJSON) { + return JSON.parse(categoriesJSON); + } } catch (e) { console.log(e); } |