@strapi/plugin-documentation 4.0.0-next.7 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/admin/src/components/FieldActionWrapper/index.js +14 -0
  2. package/admin/src/components/PluginIcon/index.js +12 -0
  3. package/admin/src/index.js +27 -12
  4. package/admin/src/pages/PluginPage/index.js +199 -0
  5. package/admin/src/pages/PluginPage/tests/index.test.js +873 -0
  6. package/admin/src/pages/PluginPage/tests/server.js +23 -0
  7. package/admin/src/pages/SettingsPage/index.js +181 -0
  8. package/admin/src/pages/SettingsPage/tests/index.test.js +612 -0
  9. package/admin/src/pages/SettingsPage/tests/server.js +18 -0
  10. package/admin/src/pages/{HomePage/utils → utils}/api.js +5 -4
  11. package/admin/src/pages/{HomePage/utils → utils}/schema.js +0 -0
  12. package/admin/src/pages/utils/useReactQuery.js +46 -0
  13. package/admin/src/translations/ar.json +0 -3
  14. package/admin/src/translations/cs.json +0 -3
  15. package/admin/src/translations/de.json +0 -3
  16. package/admin/src/translations/en.json +14 -3
  17. package/admin/src/translations/es.json +0 -3
  18. package/admin/src/translations/fr.json +0 -3
  19. package/admin/src/translations/id.json +0 -3
  20. package/admin/src/translations/it.json +0 -3
  21. package/admin/src/translations/ko.json +41 -22
  22. package/admin/src/translations/ms.json +0 -3
  23. package/admin/src/translations/nl.json +0 -3
  24. package/admin/src/translations/pl.json +0 -3
  25. package/admin/src/translations/pt-BR.json +0 -3
  26. package/admin/src/translations/pt.json +0 -3
  27. package/admin/src/translations/ru.json +0 -3
  28. package/admin/src/translations/sk.json +0 -3
  29. package/admin/src/translations/th.json +0 -3
  30. package/admin/src/translations/tr.json +0 -3
  31. package/admin/src/translations/uk.json +0 -3
  32. package/admin/src/translations/vi.json +0 -3
  33. package/admin/src/translations/zh-Hans.json +3 -6
  34. package/admin/src/translations/zh.json +0 -3
  35. package/package.json +32 -47
  36. package/server/bootstrap.js +19 -105
  37. package/server/config/default-config.js +12 -15
  38. package/server/config/index.js +10 -2
  39. package/server/controllers/documentation.js +61 -127
  40. package/server/index.js +17 -0
  41. package/server/middlewares/documentation.js +18 -41
  42. package/server/{policies/index-policy.js → middlewares/restrict-access.js} +5 -16
  43. package/{public → server/public}/index.html +0 -0
  44. package/{public → server/public}/login.html +0 -0
  45. package/server/register.js +11 -0
  46. package/server/routes/index.js +81 -3
  47. package/server/services/documentation.js +125 -1835
  48. package/server/utils/builders/build-api-endpoint-path.js +174 -0
  49. package/server/utils/builders/build-api-requests.js +41 -0
  50. package/server/utils/builders/build-api-responses.js +108 -0
  51. package/server/utils/builders/index.js +11 -0
  52. package/server/utils/clean-schema-attributes.js +205 -0
  53. package/server/utils/error-response.js +22 -0
  54. package/server/utils/get-schema-data.js +32 -0
  55. package/server/utils/query-params.js +84 -0
  56. package/strapi-admin.js +3 -0
  57. package/strapi-server.js +1 -19
  58. package/admin/src/assets/images/logo.svg +0 -1
  59. package/admin/src/components/Block/components.js +0 -26
  60. package/admin/src/components/Block/index.js +0 -39
  61. package/admin/src/components/Copy/index.js +0 -36
  62. package/admin/src/components/Header/index.js +0 -72
  63. package/admin/src/components/Row/ButtonContainer.js +0 -67
  64. package/admin/src/components/Row/components.js +0 -83
  65. package/admin/src/components/Row/index.js +0 -51
  66. package/admin/src/pages/App/index.js +0 -21
  67. package/admin/src/pages/HomePage/components.js +0 -59
  68. package/admin/src/pages/HomePage/index.js +0 -168
  69. package/admin/src/pages/HomePage/useHomePage.js +0 -56
  70. package/server/policies/index.js +0 -7
  71. package/server/routes/routes.json +0 -74
  72. package/server/services/utils/forms.json +0 -29
@@ -1 +0,0 @@
1
- <svg width="24" height="22" xmlns="http://www.w3.org/2000/svg"><text transform="translate(-23 -7)" fill="#4B515A" fill-rule="evenodd" font-family="AppleColorEmoji, Apple Color Emoji" font-size="24"><tspan x="23" y="28">🗂</tspan></text></svg>
@@ -1,26 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- const Wrapper = styled.div`
4
- margin-bottom: 28px;
5
- background: #ffffff;
6
- padding: 22px 28px 18px;
7
- border-radius: 2px;
8
- box-shadow: 0 2px 4px #e3e9f3;
9
- -webkit-font-smoothing: antialiased;
10
- `;
11
-
12
- const Title = styled.div`
13
- padding-top: 0px;
14
- line-height: 18px;
15
- > span {
16
- font-weight: 600;
17
- color: #333740;
18
- font-size: 18px;
19
- }
20
- > p {
21
- color: #787e8f;
22
- font-size: 13px;
23
- }
24
- `;
25
-
26
- export { Wrapper, Title };
@@ -1,39 +0,0 @@
1
- /**
2
- *
3
- * Block
4
- */
5
-
6
- import React from 'react';
7
- import PropTypes from 'prop-types';
8
- import { FormattedMessage } from 'react-intl';
9
- import { Wrapper, Title } from './components';
10
-
11
- const renderMsg = msg => <p>{msg}</p>;
12
-
13
- const Block = ({ children, description, style, title }) => (
14
- <div className="col-md-12">
15
- <Wrapper style={style}>
16
- <Title>
17
- <FormattedMessage id={title} />
18
- <FormattedMessage id={description}>{renderMsg}</FormattedMessage>
19
- </Title>
20
- {children}
21
- </Wrapper>
22
- </div>
23
- );
24
-
25
- Block.defaultProps = {
26
- children: null,
27
- description: 'app.utils.defaultMessage',
28
- style: {},
29
- title: 'app.utils.defaultMessage',
30
- };
31
-
32
- Block.propTypes = {
33
- children: PropTypes.any,
34
- description: PropTypes.string,
35
- style: PropTypes.object,
36
- title: PropTypes.string,
37
- };
38
-
39
- export default Block;
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import { auth, InputsIndex as Input, useNotification } from '@strapi/helper-plugin';
3
- import { CopyToClipboard } from 'react-copy-to-clipboard';
4
- import getTrad from '../../utils/getTrad';
5
-
6
- const Copy = () => {
7
- const toggleNotification = useNotification();
8
-
9
- const handleCopy = () => {
10
- toggleNotification({
11
- type: 'info',
12
- message: { id: getTrad('containers.HomePage.copied') },
13
- });
14
- };
15
-
16
- return (
17
- <CopyToClipboard text={auth.getToken()} onCopy={handleCopy}>
18
- <div className="row" style={{ zIndex: '99' }}>
19
- <Input
20
- style={{ zIndex: '9', cursor: 'pointer' }}
21
- inputStyle={{ cursor: 'pointer' }}
22
- name="jwtToken"
23
- value={auth.getToken()}
24
- type="string"
25
- onChange={() => {}}
26
- label={{ id: getTrad('containers.HomePage.form.jwtToken') }}
27
- inputDescription={{
28
- id: getTrad('containers.HomePage.form.jwtToken.description'),
29
- }}
30
- />
31
- </div>
32
- </CopyToClipboard>
33
- );
34
- };
35
-
36
- export default Copy;
@@ -1,72 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { useIntl } from 'react-intl';
4
- import { Header as BaseHeader } from '@buffetjs/custom';
5
- import { Button } from '@buffetjs/core';
6
- import { CheckPermissions } from '@strapi/helper-plugin';
7
- import openWithNewTab from '../../utils/openWithNewTab';
8
- import pluginPermissions from '../../permissions';
9
- import getTrad from '../../utils/getTrad';
10
-
11
- const Header = ({ currentDocVersion, docPrefixURL }) => {
12
- const { formatMessage } = useIntl();
13
- const headerActions = [
14
- {
15
- color: 'none',
16
- label: formatMessage({
17
- id: getTrad('containers.HomePage.Button.open'),
18
- defaultMessage: 'Open the documentation',
19
- }),
20
- className: 'buttonOutline',
21
- onClick: () => {
22
- const slash = docPrefixURL.startsWith('/') ? '' : '/';
23
-
24
- return openWithNewTab(`${slash}${docPrefixURL}/v${currentDocVersion}`);
25
- },
26
- type: 'button',
27
- key: 'button-open',
28
- Component: props => (
29
- <CheckPermissions permissions={pluginPermissions.open}>
30
- <Button {...props} />
31
- </CheckPermissions>
32
- ),
33
- },
34
- {
35
- label: formatMessage({
36
- id: getTrad('containers.HomePage.Button.update'),
37
- defaultMessage: 'Update',
38
- }),
39
- color: 'success',
40
- type: 'submit',
41
- key: 'button-submit',
42
- Component: props => (
43
- <CheckPermissions permissions={pluginPermissions.update}>
44
- <Button {...props} />
45
- </CheckPermissions>
46
- ),
47
- },
48
- ];
49
-
50
- return (
51
- <BaseHeader
52
- actions={headerActions}
53
- content={formatMessage({
54
- id: getTrad('containers.HomePage.PluginHeader.description'),
55
- defaultMessage: 'Configure the documentation plugin',
56
- })}
57
- title={{
58
- label: formatMessage({
59
- id: getTrad('containers.HomePage.PluginHeader.title'),
60
- defaultMessage: 'Documentation - Settings',
61
- }),
62
- }}
63
- />
64
- );
65
- };
66
-
67
- Header.propTypes = {
68
- currentDocVersion: PropTypes.string.isRequired,
69
- docPrefixURL: PropTypes.string.isRequired,
70
- };
71
-
72
- export default Header;
@@ -1,67 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { FormattedMessage } from 'react-intl';
4
- import { CheckPermissions } from '@strapi/helper-plugin';
5
- import pluginPermissions from '../../permissions';
6
- import openWithNewTab from '../../utils/openWithNewTab';
7
- import { StyledButton } from './components';
8
-
9
- const ButtonContainer = ({ currentDocVersion, isHeader, onClick, onClickDelete, version }) => {
10
- if (isHeader) {
11
- return <div />;
12
- }
13
-
14
- const handleClickGenerate = e => {
15
- e.preventDefault();
16
- onClick(version);
17
- };
18
-
19
- const handleDelete = e => {
20
- e.preventDefault();
21
- onClickDelete(version);
22
- };
23
-
24
- return (
25
- <div>
26
- <StyledButton
27
- type="openDocumentation"
28
- onClick={e => {
29
- e.preventDefault();
30
- openWithNewTab(`/documentation/v${version}`);
31
- }}
32
- >
33
- <FormattedMessage id="documentation.components.Row.open" />
34
- </StyledButton>
35
- <CheckPermissions permissions={pluginPermissions.regenerate}>
36
- <StyledButton
37
- // FIXME when new DS ready
38
- type="generateDocumentation"
39
- onClick={handleClickGenerate}
40
- >
41
- <FormattedMessage id="documentation.components.Row.regenerate" />
42
- </StyledButton>
43
- </CheckPermissions>
44
- <CheckPermissions permissions={pluginPermissions.update}>
45
- <StyledButton type={version === currentDocVersion ? '' : 'trash'} onClick={handleDelete} />
46
- </CheckPermissions>
47
- </div>
48
- );
49
- };
50
-
51
- ButtonContainer.defaultProps = {
52
- currentDocVersion: '1.0.0',
53
- isHeader: false,
54
- onClick: () => {},
55
- onClickDelete: () => {},
56
- version: '',
57
- };
58
-
59
- ButtonContainer.propTypes = {
60
- currentDocVersion: PropTypes.string,
61
- isHeader: PropTypes.bool,
62
- onClick: PropTypes.func,
63
- onClickDelete: PropTypes.func,
64
- version: PropTypes.string,
65
- };
66
-
67
- export default ButtonContainer;
@@ -1,83 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
- import { Button } from '@strapi/helper-plugin';
3
-
4
- const Wrapper = styled.div`
5
- height: 54px;
6
- display: flex;
7
- line-height: 53px;
8
- margin: 0 28px 0 36px;
9
- justify-content: space-between;
10
- border-bottom: 1px solid rgba(14, 22, 34, 0.04);
11
- font-size: 13px;
12
- color: #333740;
13
- > div:first-child {
14
- flex: 0 0 70px;
15
- font-weight: 500;
16
- }
17
- > div:nth-child(2) {
18
- flex: 0 0 160px;
19
- text-align: left;
20
- font-weight: 500 !important;
21
- }
22
- > div:last-child {
23
- flex: 0 0 400px;
24
- align-self: center;
25
- text-align: right;
26
- }
27
- -webkit-font-smoothing: antialiased;
28
- `;
29
-
30
- const StyledButton = styled(Button)`
31
- height: 26px;
32
- margin: 0;
33
- padding: 0 15px;
34
- line-height: initial;
35
- font-size: 13px;
36
- font-weight: 500;
37
- ${({ type }) => {
38
- if (type === 'openDocumentation') {
39
- return css`
40
- margin-right: 10px;
41
- border: 1px solid #dfe0e1;
42
- &:before {
43
- margin-right: 10px;
44
- content: '\f08e';
45
- font-family: 'FontAwesome';
46
- font-size: 10px;
47
- }
48
- `;
49
- }
50
- if (type === 'generateDocumentation') {
51
- return css`
52
- background: #e6f0fb;
53
- border: 1px solid #aed4fb;
54
- color: #007eff;
55
- &:before {
56
- margin-right: 10px;
57
- content: '\f021';
58
- font-family: 'FontAwesome';
59
- font-size: 10px;
60
- }
61
- `;
62
- }
63
- if (type === 'trash') {
64
- return css`
65
- margin-left: 25px;
66
- font-weight: 400;
67
- &:before {
68
- margin-right: 10px;
69
- content: '\f2ed';
70
- font-family: 'FontAwesome';
71
- font-size: 12 px;
72
- }
73
- `;
74
- }
75
-
76
- return css`
77
- margin-left: 45px;
78
- font-weight: 400;
79
- `;
80
- }}
81
- `;
82
-
83
- export { Wrapper, StyledButton };
@@ -1,51 +0,0 @@
1
- /**
2
- * Row
3
- */
4
-
5
- import React from 'react';
6
- import { FormattedMessage } from 'react-intl';
7
- import PropTypes from 'prop-types';
8
- import ButtonContainer from './ButtonContainer';
9
- import { Wrapper } from './components';
10
-
11
- function Row({ currentDocVersion, data, isHeader, onClickDelete, onUpdateDoc }) {
12
- const { version, generatedDate } = data;
13
-
14
- return (
15
- <Wrapper>
16
- <div>{version}</div>
17
- <div>
18
- {isHeader ? (
19
- <FormattedMessage id="documentation.components.Row.generatedDate" />
20
- ) : (
21
- <span>{generatedDate}</span>
22
- )}
23
- </div>
24
- <ButtonContainer
25
- currentDocVersion={currentDocVersion}
26
- isHeader={isHeader}
27
- version={version}
28
- onClickDelete={onClickDelete}
29
- onClick={onUpdateDoc}
30
- />
31
- </Wrapper>
32
- );
33
- }
34
-
35
- Row.defaultProps = {
36
- currentDocVersion: '1.0.0',
37
- data: {},
38
- isHeader: false,
39
- onClickDelete: () => {},
40
- onUpdateDoc: () => {},
41
- };
42
-
43
- Row.propTypes = {
44
- currentDocVersion: PropTypes.string,
45
- data: PropTypes.object,
46
- isHeader: PropTypes.bool,
47
- onClickDelete: PropTypes.func,
48
- onUpdateDoc: PropTypes.func,
49
- };
50
-
51
- export default Row;
@@ -1,21 +0,0 @@
1
- /**
2
- *
3
- * This component is the skeleton around the actual pages, and should only
4
- * contain code that should be seen on all pages. (e.g. navigation bar)
5
- *
6
- */
7
-
8
- import React from 'react';
9
- import { CheckPagePermissions } from '@strapi/helper-plugin';
10
- import pluginPermissions from '../../permissions';
11
- import HomePage from '../HomePage';
12
-
13
- function App() {
14
- return (
15
- <CheckPagePermissions permissions={pluginPermissions.main}>
16
- <HomePage />
17
- </CheckPagePermissions>
18
- );
19
- }
20
-
21
- export default App;
@@ -1,59 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- const ContainerFluid = styled.div`
4
- padding: 18px 30px;
5
- > div:first-child {
6
- max-height: 33px;
7
- }
8
-
9
- .buttonOutline {
10
- height: 30px;
11
- padding: 0 15px;
12
- border: 1px solid #dfe0e1;
13
- font-weight: 500;
14
- font-size: 13px;
15
- &:before {
16
- margin-right: 10px;
17
- content: '\f08e';
18
- font-family: 'FontAwesome';
19
- font-size: 10px;
20
- }
21
- }
22
- `;
23
-
24
- const StyledRow = styled.div`
25
- padding-top: 11px;
26
- > div:last-child {
27
- > div {
28
- padding-bottom: 0 !important;
29
- }
30
- }
31
- > div:first-child {
32
- > div {
33
- margin-bottom: 22px !important;
34
- }
35
- }
36
- `;
37
-
38
- const VersionWrapper = styled.div`
39
- margin-top: -9px;
40
- margin-left: -28px;
41
- margin-right: -28px;
42
- > div:first-child {
43
- height: 18px;
44
- line-height: 16px;
45
- border-bottom: 0;
46
-
47
- > div:nth-child(2) {
48
- font-weight: 600;
49
- color: #9ea7b8;
50
- }
51
- }
52
- > div:last-child {
53
- > div {
54
- border-bottom: none;
55
- }
56
- }
57
- `;
58
-
59
- export { ContainerFluid, StyledRow, VersionWrapper };
@@ -1,168 +0,0 @@
1
- /*
2
- *
3
- * HomePage
4
- *
5
- */
6
-
7
- import React, { useEffect, useState } from 'react';
8
- import flatten from 'lodash/flatten';
9
- import {
10
- PopUpWarning,
11
- LoadingIndicatorPage,
12
- CheckPermissions,
13
- SizedInput,
14
- getYupInnerErrors,
15
- } from '@strapi/helper-plugin';
16
- import pluginPermissions from '../../permissions';
17
- import getTrad from '../../utils/getTrad';
18
- import Block from '../../components/Block';
19
- import Copy from '../../components/Copy';
20
- import Header from '../../components/Header';
21
- import Row from '../../components/Row';
22
- import { ContainerFluid, StyledRow, VersionWrapper } from './components';
23
- import useHomePage from './useHomePage';
24
- import schema from './utils/schema';
25
-
26
- const HomePage = () => {
27
- const [versionToDelete, setVersionToDelete] = useState(null);
28
-
29
- const [{ formErrors, modifiedData }, setState] = useState({
30
- formErrors: null,
31
- modifiedData: {
32
- restrictedAccess: true,
33
- password: '',
34
- },
35
- });
36
-
37
- const { data, isLoading, deleteMutation, submitMutation, regenerateDocMutation } = useHomePage();
38
-
39
- useEffect(() => {
40
- if (data?.form) {
41
- const initialData = flatten(data.form).reduce((acc, current) => {
42
- acc[current.name] = current.value;
43
-
44
- return acc;
45
- }, {});
46
- setState({ formErrors: null, modifiedData: initialData });
47
- }
48
- }, [data]);
49
-
50
- const handleChange = ({ target: { name, value } }) => {
51
- setState(prev => ({
52
- ...prev,
53
- modifiedData: {
54
- ...prev.modifiedData,
55
- [name]: value,
56
- },
57
- }));
58
- };
59
-
60
- const handleDeleteDoc = version => {
61
- setVersionToDelete(version);
62
- };
63
-
64
- const handleConfirmDeleteDoc = () => {
65
- deleteMutation.mutate({ prefix: data.prefix, version: versionToDelete });
66
- toggleModal();
67
- };
68
-
69
- const handleSubmit = async e => {
70
- e.preventDefault();
71
-
72
- try {
73
- await schema.validate(modifiedData, { abortEarly: false });
74
-
75
- setState(prev => ({ ...prev, formErrors: null }));
76
-
77
- submitMutation.mutate({ body: modifiedData, prefix: data.prefix });
78
- } catch (err) {
79
- const errors = getYupInnerErrors(err);
80
-
81
- setState(prev => ({ ...prev, formErrors: errors }));
82
- }
83
- };
84
-
85
- const handleUpdateDoc = version => {
86
- regenerateDocMutation.mutate({ version, prefix: data.prefix });
87
- };
88
-
89
- const toggleModal = () => {
90
- setVersionToDelete(null);
91
- };
92
-
93
- if (isLoading) {
94
- return <LoadingIndicatorPage />;
95
- }
96
-
97
- return (
98
- <ContainerFluid className="container-fluid">
99
- <PopUpWarning
100
- isOpen={versionToDelete !== null}
101
- toggleModal={toggleModal}
102
- content={{
103
- title: 'components.popUpWarning.title',
104
- message: getTrad('containers.HomePage.PopUpWarning.message'),
105
- cancel: 'app.components.Button.cancel',
106
- confirm: getTrad('containers.HomePage.PopUpWarning.confirm'),
107
- }}
108
- popUpWarningType="danger"
109
- onConfirm={handleConfirmDeleteDoc}
110
- />
111
- <form onSubmit={handleSubmit}>
112
- <Header currentDocVersion={data.currentVersion} docPrefixURL={data.prefix} />
113
- <StyledRow className="row">
114
- <Block>
115
- <Copy />
116
- </Block>
117
- <CheckPermissions permissions={pluginPermissions.update}>
118
- <Block>
119
- <div className="row">
120
- <SizedInput
121
- description={getTrad(
122
- 'containers.HomePage.form.restrictedAccess.inputDescription'
123
- )}
124
- label={getTrad('containers.HomePage.form.restrictedAccess')}
125
- name="restrictedAccess"
126
- onChange={handleChange}
127
- size={{ xs: 6 }}
128
- type="bool"
129
- value={modifiedData.restrictedAccess}
130
- />
131
- {modifiedData.restrictedAccess && (
132
- <SizedInput
133
- description={getTrad('containers.HomePage.form.password.inputDescription')}
134
- label={getTrad('containers.HomePage.form.password')}
135
- error={formErrors?.password}
136
- name="password"
137
- onChange={handleChange}
138
- size={{ xs: 6 }}
139
- type="password"
140
- value={modifiedData.password}
141
- />
142
- )}
143
- </div>
144
- </Block>
145
- </CheckPermissions>
146
- <Block title={getTrad('containers.HomePage.Block.title')}>
147
- <VersionWrapper>
148
- <Row isHeader />
149
- {data.docVersions.map(doc => {
150
- return (
151
- <Row
152
- key={doc.generatedDate}
153
- data={doc}
154
- currentDocVersion={data.currentVersion}
155
- onClickDelete={handleDeleteDoc}
156
- onUpdateDoc={handleUpdateDoc}
157
- />
158
- );
159
- })}
160
- </VersionWrapper>
161
- </Block>
162
- </StyledRow>
163
- </form>
164
- </ContainerFluid>
165
- );
166
- };
167
-
168
- export default HomePage;
@@ -1,56 +0,0 @@
1
- import { useQuery, useMutation, useQueryClient } from 'react-query';
2
- import { useNotification } from '@strapi/helper-plugin';
3
- import { fetchData, deleteDoc, regenerateDoc, submit } from './utils/api';
4
- import getTrad from '../../utils/getTrad';
5
-
6
- const useHomePage = () => {
7
- const queryClient = useQueryClient();
8
- const toggleNotification = useNotification();
9
- const { isLoading, data } = useQuery('get-documentation', () => fetchData(toggleNotification));
10
-
11
- const handleError = err => {
12
- toggleNotification({
13
- type: 'warning',
14
- message: err.response.payload.message,
15
- });
16
- };
17
-
18
- const deleteMutation = useMutation(deleteDoc, {
19
- onSuccess: () => {
20
- queryClient.invalidateQueries('get-documentation');
21
- toggleNotification({
22
- type: 'info',
23
- message: { id: getTrad('notification.delete.success') },
24
- });
25
- },
26
- onError: handleError,
27
- });
28
-
29
- const submitMutation = useMutation(submit, {
30
- onSuccess: () => {
31
- queryClient.invalidateQueries('get-documentation');
32
-
33
- toggleNotification({
34
- type: 'success',
35
- message: { id: getTrad('notification.update.success') },
36
- });
37
- },
38
- onError: handleError,
39
- });
40
-
41
- const regenerateDocMutation = useMutation(regenerateDoc, {
42
- onSuccess: () => {
43
- queryClient.invalidateQueries('get-documentation');
44
-
45
- toggleNotification({
46
- type: 'info',
47
- message: { id: getTrad('notification.generate.success') },
48
- });
49
- },
50
- onError: handleError,
51
- });
52
-
53
- return { data, isLoading, deleteMutation, submitMutation, regenerateDocMutation };
54
- };
55
-
56
- export default useHomePage;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-policy');
4
-
5
- module.exports = {
6
- index,
7
- };