diff options
author | Ivan Chen <ivan@tagg.id> | 2021-03-27 20:30:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-27 20:30:36 -0400 |
commit | 67fb6f5cae06dfbcb359dd6468cb66ad85fa230d (patch) | |
tree | eaf092811d5be72e89e4dec9942dc59a1f8a0211 /src/utils/search.ts | |
parent | bef5728b24a71d1bf327a72e425346020a997037 (diff) | |
parent | bf0a2abf8bab333ff0d87bc07002e6f96199ce3b (diff) |
Merge pull request #330 from ankit-thanekar007/tma-722-cornell-fe
[TMA 722] : Cornell FrontEnd changes
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); } |