mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
cf2dfc6bf1
[SettingsPage] Integration Branch GitOrigin-RevId: 5a3c26b2a02d716c4ae3981e3f08b811ae307725
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import {
|
|
Actions,
|
|
ActionSetData,
|
|
ActionSetLoading,
|
|
ActionMakePrimary,
|
|
ActionDeleteEmail,
|
|
ActionSetEmailAffiliationBeingEdited,
|
|
ActionUpdateAffiliation,
|
|
} from '../context/user-email-context'
|
|
import { UserEmailData } from '../../../../../types/user-email'
|
|
import { Nullable } from '../../../../../types/utils'
|
|
import { Affiliation } from '../../../../../types/affiliation'
|
|
|
|
export const setData = (data: UserEmailData[]): ActionSetData => ({
|
|
type: Actions.SET_DATA,
|
|
payload: data,
|
|
})
|
|
|
|
export const setLoading = (flag: boolean): ActionSetLoading => ({
|
|
type: Actions.SET_LOADING_STATE,
|
|
payload: flag,
|
|
})
|
|
|
|
export const makePrimary = (
|
|
email: UserEmailData['email']
|
|
): ActionMakePrimary => ({
|
|
type: Actions.MAKE_PRIMARY,
|
|
payload: email,
|
|
})
|
|
|
|
export const deleteEmail = (
|
|
email: UserEmailData['email']
|
|
): ActionDeleteEmail => ({
|
|
type: Actions.DELETE_EMAIL,
|
|
payload: email,
|
|
})
|
|
|
|
export const setEmailAffiliationBeingEdited = (
|
|
email: Nullable<UserEmailData['email']>
|
|
): ActionSetEmailAffiliationBeingEdited => ({
|
|
type: Actions.SET_EMAIL_AFFILIATION_BEING_EDITED,
|
|
payload: email,
|
|
})
|
|
|
|
export const updateAffiliation = (
|
|
email: UserEmailData['email'],
|
|
role: Affiliation['role'],
|
|
department: Affiliation['department']
|
|
): ActionUpdateAffiliation => ({
|
|
type: Actions.UPDATE_AFFILIATION,
|
|
payload: { email, role, department },
|
|
})
|