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