diff options
author | Ashm Walia <ashmwalia@outlook.com> | 2021-01-31 20:47:03 -0800 |
---|---|---|
committer | Ashm Walia <ashmwalia@outlook.com> | 2021-01-31 20:47:03 -0800 |
commit | 85c9a80e8867ff5303bfcc49b79b8bc5f25a2f61 (patch) | |
tree | f2d65dddf647729c08878db0dfb6a80892bf7d69 | |
parent | 89cd5a2ea87f89b98522d8ab063d089d008d3a4b (diff) |
Done
-rw-r--r-- | src/store/actions/userX.ts | 81 | ||||
-rw-r--r-- | src/types/types.ts | 8 |
2 files changed, 0 insertions, 89 deletions
diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts index af8188f1..07bea678 100644 --- a/src/store/actions/userX.ts +++ b/src/store/actions/userX.ts @@ -1,4 +1,3 @@ -import {UserXSpecifics} from './../../types/types'; import {userXInStore} from './../../utils/'; import {getTokenOrLogout, loadAllSocialsForUser} from './../../utils'; import {UserType, ScreenType} from '../../types/types'; @@ -86,86 +85,6 @@ export const loadUserX = ( } }; -export const loadUserXSpecifics = ( - user: UserType, - specifics: UserXSpecifics[], - screenType: ScreenType, -): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async ( - dispatch, -) => { - const {userId} = user; - await dispatch({type: userXRequested.type, payload: {screenType, userId}}); - await dispatch({ - type: userXUserFetched.type, - payload: {screenType, userId, user}, - }); - const token = await getTokenOrLogout(dispatch); - for (let specific of specifics) { - switch (specific) { - case 'Profile': - console.log(specific); - loadProfileInfo(token, userId).then((data) => { - dispatch({ - type: userXProfileFetched.type, - payload: {screenType, userId, data}, - }); - }); - break; - case 'Socials': - loadAllSocialsForUser(userId).then((data) => - dispatch({ - type: userXSocialsFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'Avatar': - loadAvatar(userId, false).then((data) => - dispatch({ - type: userXAvatarFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'Cover': - loadCover(token, userId).then((data) => - dispatch({ - type: userXCoverFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'Friends': - loadFriends(userId, token).then((data) => - dispatch({ - type: userXFriendsFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'Moments': - console.log(specific); - loadMoments(userId, token).then((data) => - dispatch({ - type: userXMomentsFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'MomentCategories': - loadMomentCategories(userId, token).then((data) => { - dispatch({ - type: userXMomentCategoriesFetched.type, - payload: {screenType, userId, data}, - }); - }); - break; - default: - break; - } - } -}; - export const updateUserXFriends = ( userId: string, state: RootState, diff --git a/src/types/types.ts b/src/types/types.ts index e9abc789..1775cd5f 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -186,11 +186,3 @@ export type NotificationType = { }; export type TypeOfComment = 'Comment' | 'Thread'; -export type UserXSpecifics = - | 'Profile' - | 'Socials' - | 'Avatar' - | 'Cover' - | 'Friends' - | 'Moments' - | 'MomentCategories'; |