From a42e7d28a55f6abbb4a0ac1689b6a5d87c3abec4 Mon Sep 17 00:00:00 2001 From: Felix Hallenberg Date: Sat, 4 Nov 2023 16:44:35 +0200 Subject: [PATCH] Improve codestyle, more fpts --- src/state/reducers/accessToken.ts | 10 ++++++---- src/state/reducers/mentors.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/state/reducers/accessToken.ts b/src/state/reducers/accessToken.ts index ab559e99..180cfd42 100644 --- a/src/state/reducers/accessToken.ts +++ b/src/state/reducers/accessToken.ts @@ -37,10 +37,12 @@ export const isMentor = flow( O.toUndefined, id => !!id, ); -export const isMe = (mentorId: string) => (appState: AppState) => { - const userId = getUserId(appState); - return userId === mentorId; -}; + +export const isMe = (mentorId: string) => (appState: AppState) => + pipe(getUserId(appState), compareIds(mentorId)); + +const compareIds = (mentorId: string) => (userId: string | undefined) => + mentorId === userId; export function withToken( task: (token: authApi.AccessToken) => T.Task, diff --git a/src/state/reducers/mentors.ts b/src/state/reducers/mentors.ts index 4914799c..13ac86be 100644 --- a/src/state/reducers/mentors.ts +++ b/src/state/reducers/mentors.ts @@ -121,7 +121,7 @@ const withVacationing = export const selectMentorList = (appState: types.AppState) => { const remoteMentors = get(appState); - const { skillFilter, shouldHideInactiveMentors } = appState['filterMentors']; + const { skillFilter, shouldHideInactiveMentors } = appState.filterMentors; return RD.remoteData.map(remoteMentors, mentors => mentors