2021-05-11 14:25:22 +00:00
|
|
|
import useFetchMock from './hooks/use-fetch-mock'
|
2021-09-14 08:54:21 +00:00
|
|
|
import CloneProjectModal from '../js/features/clone-project-modal/components/clone-project-modal'
|
2022-05-16 09:38:20 +00:00
|
|
|
import { ScopeDecorator } from './decorators/scope'
|
2021-09-14 08:54:21 +00:00
|
|
|
|
|
|
|
export const Success = args => {
|
2021-05-11 14:25:22 +00:00
|
|
|
useFetchMock(fetchMock => {
|
|
|
|
fetchMock.post(
|
|
|
|
'express:/project/:projectId/clone',
|
2021-09-14 08:54:21 +00:00
|
|
|
{ status: 200 },
|
|
|
|
{ delay: 250 }
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2022-05-16 09:38:20 +00:00
|
|
|
return <CloneProjectModal {...args} />
|
2021-09-14 08:54:21 +00:00
|
|
|
}
|
2021-01-06 10:30:08 +00:00
|
|
|
|
2021-09-14 08:54:21 +00:00
|
|
|
export const GenericErrorResponse = args => {
|
|
|
|
useFetchMock(fetchMock => {
|
|
|
|
fetchMock.post(
|
|
|
|
'express:/project/:projectId/clone',
|
|
|
|
{ status: 500 },
|
|
|
|
{ delay: 250 }
|
2021-05-11 14:25:22 +00:00
|
|
|
)
|
|
|
|
})
|
2021-01-06 10:30:08 +00:00
|
|
|
|
2022-05-16 09:38:20 +00:00
|
|
|
return <CloneProjectModal {...args} />
|
2021-01-06 10:30:08 +00:00
|
|
|
}
|
2021-09-14 08:54:21 +00:00
|
|
|
|
|
|
|
export const SpecificErrorResponse = args => {
|
|
|
|
useFetchMock(fetchMock => {
|
|
|
|
fetchMock.post(
|
|
|
|
'express:/project/:projectId/clone',
|
|
|
|
{ status: 400, body: 'The project name is not valid' },
|
|
|
|
{ delay: 250 }
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2022-05-16 09:38:20 +00:00
|
|
|
return <CloneProjectModal {...args} />
|
2021-01-06 10:30:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2022-03-28 10:23:21 +00:00
|
|
|
title: 'Editor / Modals / Clone Project',
|
2021-03-05 13:00:13 +00:00
|
|
|
component: CloneProjectModal,
|
2021-01-06 10:30:08 +00:00
|
|
|
args: {
|
2021-04-27 07:52:58 +00:00
|
|
|
show: true,
|
2021-01-06 10:30:08 +00:00
|
|
|
},
|
|
|
|
argTypes: {
|
2021-03-05 13:00:13 +00:00
|
|
|
handleHide: { action: 'close modal' },
|
|
|
|
openProject: { action: 'open project' },
|
2022-09-22 18:24:33 +00:00
|
|
|
handleAfterCloned: { action: 'after cloned' },
|
2021-04-27 07:52:58 +00:00
|
|
|
},
|
2022-05-16 09:38:20 +00:00
|
|
|
decorators: [ScopeDecorator],
|
2021-01-06 10:30:08 +00:00
|
|
|
}
|