mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 02:05:22 -05:00
69482d9d3c
GitOrigin-RevId: 03f5164d117713efd78c9806bdda6e6d5c90f6dc
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import useFetchMock from './hooks/use-fetch-mock'
|
|
import { withContextRoot } from './utils/with-context-root'
|
|
import CloneProjectModal from '../js/features/clone-project-modal/components/clone-project-modal'
|
|
|
|
const project = { _id: 'original-project', name: 'Project Title' }
|
|
|
|
export const Success = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(
|
|
'express:/project/:projectId/clone',
|
|
{ status: 200 },
|
|
{ delay: 250 }
|
|
)
|
|
})
|
|
|
|
return withContextRoot(<CloneProjectModal {...args} />, { project })
|
|
}
|
|
|
|
export const GenericErrorResponse = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(
|
|
'express:/project/:projectId/clone',
|
|
{ status: 500 },
|
|
{ delay: 250 }
|
|
)
|
|
})
|
|
|
|
return withContextRoot(<CloneProjectModal {...args} />, { project })
|
|
}
|
|
|
|
export const SpecificErrorResponse = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(
|
|
'express:/project/:projectId/clone',
|
|
{ status: 400, body: 'The project name is not valid' },
|
|
{ delay: 250 }
|
|
)
|
|
})
|
|
|
|
return withContextRoot(<CloneProjectModal {...args} />, { project })
|
|
}
|
|
|
|
export default {
|
|
title: 'Modals / Clone Project',
|
|
component: CloneProjectModal,
|
|
args: {
|
|
show: true,
|
|
},
|
|
argTypes: {
|
|
handleHide: { action: 'close modal' },
|
|
openProject: { action: 'open project' },
|
|
},
|
|
}
|