overleaf/services/web/frontend/js/features/settings/utils/selectors.ts
Timothée Alby cf2dfc6bf1 Merge pull request #7593 from overleaf/ta-settings-migration
[SettingsPage] Integration Branch

GitOrigin-RevId: 5a3c26b2a02d716c4ae3981e3f08b811ae307725
2022-04-25 08:05:12 +00:00

22 lines
699 B
TypeScript

import { State } from '../context/user-email-context'
import { UserEmailData } from '../../../../../types/user-email'
export const inReconfirmNotificationPeriod = (userEmailData: UserEmailData) => {
return userEmailData.affiliation?.inReconfirmNotificationPeriod
}
export const institutionAlreadyLinked = (
state: State,
userEmailData: UserEmailData
) => {
const institutionId = userEmailData.affiliation?.institution.id?.toString()
return institutionId !== undefined
? state.data.linkedInstitutionIds.includes(institutionId)
: false
}
export const isChangingAffiliation = (
state: State,
email: UserEmailData['email']
) => state.data.emailAffiliationBeingEdited === email