diff options
| author | Shravya Ramesh <37447613+shravyaramesh@users.noreply.github.com> | 2020-11-20 13:20:49 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-20 16:20:49 -0500 |
| commit | 3214fc765cbce3c6f9092546424249d08622afb1 (patch) | |
| tree | 862aa8872d670195f2a33264f672782ea1077c9c /src/routes | |
| parent | 713d169915a82edfcfe4b44622e3dce8c6adaf0c (diff) | |
[TMA-375] Added discover users to explore (#119)
* Added discover users to explore
* Filtered following users out
* Removed reload button and filtering following users from discover page
* Wrapped contents
* Preview type in types.ts
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/authentication/AuthProvider.tsx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/routes/authentication/AuthProvider.tsx b/src/routes/authentication/AuthProvider.tsx index 7046d04f..46f761e1 100644 --- a/src/routes/authentication/AuthProvider.tsx +++ b/src/routes/authentication/AuthProvider.tsx @@ -10,6 +10,7 @@ import { loadProfileInfo, loadRecentlySearchedUsers, loadSocialPosts, + getAllTaggUsers, loadBlockedUsers, } from '../../services'; import { @@ -29,6 +30,7 @@ interface AuthContextProps { cover: string | null; socialAccounts: Record<string, SocialAccountType>; recentSearches: Array<ProfilePreviewType>; + taggUsers: Array<ProfilePreviewType>; newMomentsAvailable: boolean; updateMoments: (value: boolean) => void; socialsNeedUpdate: (_: string[]) => void; @@ -71,6 +73,7 @@ export const AuthContext = createContext<AuthContextProps>({ avatar: null, cover: null, recentSearches: [], + taggUsers: [], newMomentsAvailable: true, updateMoments: () => {}, socialAccounts: NO_SOCIAL_ACCOUNTS, @@ -101,6 +104,7 @@ const AuthProvider: React.FC = ({children}) => { const [recentSearches, setRecentSearches] = useState< Array<ProfilePreviewType> >([]); + const [taggUsers, setTaggUsers] = useState<Array<ProfilePreviewType>>([]); const [newMomentsAvailable, setNewMomentsAvailable] = useState<boolean>(true); // Default update all integrated social lists on start const [socialsNeedUpdate, setSocialsNeedUpdate] = useState<string[]>([ @@ -236,6 +240,22 @@ const AuthProvider: React.FC = ({children}) => { userId, setBlockedUsers, ]); + + useEffect(() => { + const loadTaggUsers = async () => { + try { + const token = await AsyncStorage.getItem('token'); + if (!token) { + setUser(NO_USER); + return; + } + await getAllTaggUsers(token, setTaggUsers); + } catch (error) { + console.log(error); + } + }; + loadTaggUsers(); + }, [userId]); return ( <AuthContext.Provider @@ -270,6 +290,7 @@ const AuthProvider: React.FC = ({children}) => { } }, recentSearches, + taggUsers, updateMoments: (value) => { setNewMomentsAvailable(value); }, |
