mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
5b0c122f5d
List of user emails GitOrigin-RevId: 28a8e405812932ba7ebd8043a4dc9d3c573a68b2
75 lines
1.5 KiB
JavaScript
75 lines
1.5 KiB
JavaScript
import EmailsSection from '../js/features/settings/components/emails-section'
|
|
import useFetchMock from './hooks/use-fetch-mock'
|
|
|
|
const MOCK_DELAY = 1000
|
|
window.metaAttributesCache = window.metaAttributesCache || new Map()
|
|
|
|
function defaultSetupMocks(fetchMock) {
|
|
fetchMock.post(
|
|
/\/user\/emails\/resend_confirmation/,
|
|
(path, req) => {
|
|
return 200
|
|
},
|
|
{
|
|
delay: MOCK_DELAY,
|
|
}
|
|
)
|
|
}
|
|
|
|
const fakeUsersData = [
|
|
{
|
|
affiliation: {
|
|
institution: {
|
|
confirmed: true,
|
|
},
|
|
licence: 'pro_plus',
|
|
},
|
|
confirmedAt: '2022-03-09T10:59:44.139Z',
|
|
email: 'foo@overleaf.com',
|
|
default: true,
|
|
},
|
|
{
|
|
confirmedAt: '2022-03-10T10:59:44.139Z',
|
|
email: 'bar@overleaf.com',
|
|
default: false,
|
|
},
|
|
{
|
|
email: 'baz@overleaf.com',
|
|
default: false,
|
|
},
|
|
{
|
|
email: 'qux@overleaf.com',
|
|
default: false,
|
|
},
|
|
]
|
|
|
|
export const EmailsList = args => {
|
|
useFetchMock(defaultSetupMocks)
|
|
window.metaAttributesCache.set('ol-userEmails', fakeUsersData)
|
|
|
|
return <EmailsSection {...args} />
|
|
}
|
|
|
|
export const NetworkErrors = args => {
|
|
useFetchMock(defaultSetupMocks)
|
|
window.metaAttributesCache.set('ol-userEmails', fakeUsersData)
|
|
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(
|
|
/\/user\/emails\/resend_confirmation/,
|
|
() => {
|
|
return 503
|
|
},
|
|
{
|
|
delay: MOCK_DELAY,
|
|
}
|
|
)
|
|
})
|
|
|
|
return <EmailsSection {...args} />
|
|
}
|
|
|
|
export default {
|
|
title: 'Emails and Affiliations',
|
|
component: EmailsSection,
|
|
}
|