mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 20:32:07 +00:00
d91ee50762
GitOrigin-RevId: 109a4357fc3b083ffbd3af5b8c98acf0f655f297
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
import useFetchMock from './hooks/use-fetch-mock'
|
|
import CloneProjectModal from '../js/features/clone-project-modal/components/clone-project-modal'
|
|
import { ScopeDecorator } from './decorators/scope'
|
|
|
|
export const Success = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(
|
|
'express:/project/:projectId/clone',
|
|
{ status: 200 },
|
|
{ delay: 250 }
|
|
)
|
|
})
|
|
|
|
return <CloneProjectModal {...args} />
|
|
}
|
|
|
|
export const GenericErrorResponse = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(
|
|
'express:/project/:projectId/clone',
|
|
{ status: 500 },
|
|
{ delay: 250 }
|
|
)
|
|
})
|
|
|
|
return <CloneProjectModal {...args} />
|
|
}
|
|
|
|
export const SpecificErrorResponse = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(
|
|
'express:/project/:projectId/clone',
|
|
{ status: 400, body: 'The project name is not valid' },
|
|
{ delay: 250 }
|
|
)
|
|
})
|
|
|
|
return <CloneProjectModal {...args} />
|
|
}
|
|
|
|
export default {
|
|
title: 'Editor / Modals / Clone Project',
|
|
component: CloneProjectModal,
|
|
args: {
|
|
show: true,
|
|
},
|
|
argTypes: {
|
|
handleHide: { action: 'close modal' },
|
|
openProject: { action: 'open project' },
|
|
},
|
|
decorators: [ScopeDecorator],
|
|
}
|