generator-pninja 2.0.0 → 2.0.2
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.
- package/generators/client/templates/react/public/locales/common/am.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ar.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/az.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/bg.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/bn.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ca.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/cs.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/cy.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/da.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/de.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/el.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/en.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/es.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/et.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/eu.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/fa.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/fi.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/fr.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/fy.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ga.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/gl.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/gu.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ha.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/he.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/hi.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/hr.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ht.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/hu.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/hy.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/id.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/is.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/it.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ja.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/kk.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ko.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/lt.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/lv.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/mi.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ms.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/mt.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/nl.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/no.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/om.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/pl.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/pt.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ro.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ru.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/rw.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/sk.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/sl.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/sq.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/sr.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/sv.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/sw.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ta.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/tr.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/uk.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/ur.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/uz.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/vi.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/yo.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/zh.json.ejs +7 -2
- package/generators/client/templates/react/public/locales/common/zu.json.ejs +7 -2
- package/generators/client/templates/react/src/components/BlobViewer.tsx.ejs +63 -33
- package/generators/client/templates/react/src/components/entities/EntityForm.tsx.ejs +1 -0
- package/generators/client/templates/react/src/components/formElements/FileField.tsx.ejs +267 -110
- package/generators/client/templates/react/src/index.css.ejs +8 -0
- package/generators/client/templates/react/src/pages/entities/EntityEdit.tsx.ejs +21 -21
- package/package.json +1 -1
|
@@ -55,30 +55,30 @@ export default function <%= entity.name %>Edit() {
|
|
|
55
55
|
}
|
|
56
56
|
}, [id, addNotification, navigate, t]);
|
|
57
57
|
|
|
58
|
-
const handleSubmit = (data: I<%= entity.name %>) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
const handleSubmit = async (data: I<%= entity.name %>) => {
|
|
59
|
+
try {
|
|
60
|
+
const result = await (id
|
|
61
|
+
? <%= entity.name %>Service.update(Number(id), data)
|
|
62
|
+
: <%= entity.name %>Service.create(data)
|
|
63
|
+
);
|
|
64
64
|
<%_ if (entity.pessimisticLock) { _%>
|
|
65
|
-
|
|
65
|
+
release();
|
|
66
66
|
<%_ } _%>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
73
|
-
navigate('/<%- entity.name === 'AcRule' ? 'admin' : 'entities' %>/<%=to.slug(pluralize(entity.name))%>');
|
|
74
|
-
})
|
|
75
|
-
.catch((error: AxiosError<ErrorResponseData>) => {
|
|
76
|
-
addNotification({
|
|
77
|
-
type: 'error',
|
|
78
|
-
message: `${t(id ? 'errors.entities.update' : 'errors.entities.create')} ${t('entities:<%-to.snake(entity.name)%>.<%= entity.name %>')}${id ? ` ID ${id}` : ''}`,
|
|
79
|
-
error,
|
|
80
|
-
});
|
|
67
|
+
addNotification({
|
|
68
|
+
type: 'success',
|
|
69
|
+
message: t(`actions.crud.successfully${id ? 'Updated' : 'Created'}`, {
|
|
70
|
+
id: id || result.id,
|
|
71
|
+
}),
|
|
81
72
|
});
|
|
73
|
+
navigate('/<%- entity.name === 'AcRule' ? 'admin' : 'entities' %>/<%=to.slug(pluralize(entity.name))%>');
|
|
74
|
+
} catch (error) {
|
|
75
|
+
addNotification({
|
|
76
|
+
type: 'error',
|
|
77
|
+
message: `${t(id ? 'errors.entities.update' : 'errors.entities.create')} ${t('entities:<%-to.snake(entity.name)%>.<%= entity.name %>')}${id ? ` ID ${id}` : ''}`,
|
|
78
|
+
error: error as AxiosError<ErrorResponseData>,
|
|
79
|
+
});
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
const handleCancel = () => {
|