-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #460 from getguesstimate/master
v0.5.1: Organizational Member Edit Pages
- Loading branch information
Showing
24 changed files
with
792 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createSelector } from 'reselect'; | ||
|
||
const specificHttpRequestSelector = state => state.httpRequests | ||
const organizationIdSelector = (state, props) => props.organizationId | ||
|
||
function isExistingMember(request) { | ||
return !!_.get(request, 'response.hasUser') | ||
} | ||
|
||
export const httpRequestSelector = createSelector( | ||
specificHttpRequestSelector, | ||
organizationIdSelector, | ||
(httpRequests, organizationId) => { | ||
|
||
let relevantRequests = httpRequests.filter(r => ( | ||
(r.metadata.organizationId === organizationId) && | ||
(r.entity === 'userOrganizationMembershipCreate') | ||
)) | ||
|
||
let formattedRequests = relevantRequests.map(r => ({ | ||
id: r.id, | ||
busy: r.busy, | ||
success: r.success, | ||
email: r.metadata.email, | ||
created_at: r.created_at, | ||
isExistingMember: isExistingMember(r) | ||
})) | ||
|
||
return { | ||
httpRequests: formattedRequests | ||
} | ||
} | ||
); |
Oops, something went wrong.