mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
cf2dfc6bf1
[SettingsPage] Integration Branch GitOrigin-RevId: 5a3c26b2a02d716c4ae3981e3f08b811ae307725
71 lines
1.6 KiB
JavaScript
71 lines
1.6 KiB
JavaScript
import useFetchMock from '../hooks/use-fetch-mock'
|
|
import LeaveModal from '../../js/features/settings/components/leave/modal'
|
|
import LeaveSection from '../../js/features/settings/components/leave-section'
|
|
import { setDefaultMeta, defaultSetupMocks } from './helpers/leave'
|
|
|
|
export const Section = args => {
|
|
useFetchMock(defaultSetupMocks)
|
|
setDefaultMeta()
|
|
|
|
return <LeaveSection {...args} />
|
|
}
|
|
Section.component = LeaveSection
|
|
Section.parameters = { controls: { include: [], hideNoControlsWarning: true } }
|
|
|
|
export const ModalSuccess = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export const ModalWithoutPassword = args => {
|
|
setDefaultMeta()
|
|
window.metaAttributesCache.set('ol-hasPassword', false)
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export const ModalAuthError = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(/\/user\/delete/, 403)
|
|
})
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export const ModalServerError = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(/\/user\/delete/, 500)
|
|
})
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export const ModalSubscriptionError = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(/\/user\/delete/, {
|
|
status: 422,
|
|
body: {
|
|
error: 'SubscriptionAdminDeletionError',
|
|
},
|
|
})
|
|
})
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export default {
|
|
title: 'Account Settings / Leave',
|
|
component: LeaveModal,
|
|
args: {
|
|
isOpen: true,
|
|
},
|
|
argTypes: {
|
|
handleClose: { action: 'handleClose' },
|
|
},
|
|
}
|