aboutsummaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorIvan Chen <ivan@thetaggid.com>2021-01-13 02:58:24 -0500
committerGitHub <noreply@github.com>2021-01-13 02:58:24 -0500
commit353c1ec685698bb86e0ff96a346d88205ee389cf (patch)
tree021f721cc8eb94ab007183c39d808e9eb3a468e8 /src/store
parent5664f30a218af4620be69c66f4aba93d5972f890 (diff)
[TMA-531] New Explore Page (#179)
* redux done * done * added refresh control * added profile navigation * minor spacing change
Diffstat (limited to 'src/store')
-rw-r--r--src/store/actions/taggUsers.ts10
-rw-r--r--src/store/initialStates.ts15
-rw-r--r--src/store/reducers/taggUsersReducer.ts4
3 files changed, 20 insertions, 9 deletions
diff --git a/src/store/actions/taggUsers.ts b/src/store/actions/taggUsers.ts
index 7f841c51..7b6d4d5e 100644
--- a/src/store/actions/taggUsers.ts
+++ b/src/store/actions/taggUsers.ts
@@ -1,8 +1,7 @@
-import {RootState} from '../rootReducer';
-import {loadRecentlySearchedUsers, getAllTaggUsers} from '../../services';
import {Action, ThunkAction} from '@reduxjs/toolkit';
+import {getAllExploreSections, loadRecentlySearchedUsers} from '../../services';
import {taggUsersFetched} from '../reducers';
-import {getTokenOrLogout} from '../../utils';
+import {RootState} from '../rootReducer';
export const loadRecentlySearched = (): ThunkAction<
Promise<void>,
@@ -11,12 +10,11 @@ export const loadRecentlySearched = (): ThunkAction<
Action<string>
> => async (dispatch) => {
try {
- const token = await getTokenOrLogout(dispatch);
const recentSearches = await loadRecentlySearchedUsers();
- const taggUsers = await getAllTaggUsers(token);
+ const exploreSections = await getAllExploreSections();
dispatch({
type: taggUsersFetched.type,
- payload: {recentSearches, taggUsers},
+ payload: {recentSearches, explores: exploreSections},
});
} catch (error) {
console.log(error);
diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts
index de97b129..87e1ce22 100644
--- a/src/store/initialStates.ts
+++ b/src/store/initialStates.ts
@@ -1,4 +1,5 @@
import {
+ ExploreSectionType,
MomentType,
NotificationType,
ProfilePreviewType,
@@ -58,9 +59,21 @@ export const NO_SOCIAL_ACCOUNTS: Record<string, SocialAccountType> = {
Twitter: {posts: []},
};
+export const EMPTY_EXPLORE_SECTIONS: Record<
+ ExploreSectionType,
+ ProfilePreviewType[]
+> = {
+ 'People You May Know': EMPTY_PROFILE_PREVIEW_LIST,
+ 'New to Tagg': EMPTY_PROFILE_PREVIEW_LIST,
+ 'Trending on Tagg': EMPTY_PROFILE_PREVIEW_LIST,
+ "Brown '21": EMPTY_PROFILE_PREVIEW_LIST,
+ "Brown '22": EMPTY_PROFILE_PREVIEW_LIST,
+ "Brown '23": EMPTY_PROFILE_PREVIEW_LIST,
+};
+
export const NO_TAGG_USERS = {
recentSearches: EMPTY_PROFILE_PREVIEW_LIST,
- taggUsers: EMPTY_PROFILE_PREVIEW_LIST,
+ explores: EMPTY_EXPLORE_SECTIONS,
};
export const NO_SOCIALS = {
diff --git a/src/store/reducers/taggUsersReducer.ts b/src/store/reducers/taggUsersReducer.ts
index ff30f7a0..33e2e18d 100644
--- a/src/store/reducers/taggUsersReducer.ts
+++ b/src/store/reducers/taggUsersReducer.ts
@@ -6,8 +6,8 @@ const taggUsersSlice = createSlice({
initialState: NO_TAGG_USERS,
reducers: {
taggUsersFetched: (state, action) => {
- state.recentSearches = action.payload.taggUsers;
- state.taggUsers = action.payload.taggUsers;
+ state.recentSearches = action.payload.recentSearches;
+ state.explores = action.payload.explores;
},
},
});