From 85c9a80e8867ff5303bfcc49b79b8bc5f25a2f61 Mon Sep 17 00:00:00 2001 From: Ashm Walia Date: Sun, 31 Jan 2021 20:47:03 -0800 Subject: Done --- src/store/actions/userX.ts | 81 ---------------------------------------------- src/types/types.ts | 8 ----- 2 files changed, 89 deletions(-) (limited to 'src') 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, RootState, unknown, Action> => 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'; -- cgit v1.2.3-70-g09d2