summaryrefslogtreecommitdiff
path: root/frontend/views/graph
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-06-02 20:27:59 +0200
committerJules Laplace <julescarbon@gmail.com>2020-06-02 20:27:59 +0200
commit402dd17858076b6a0fac618de85614114dfe94fe (patch)
treed737ad09aa3498d74e306fc5a86c25ccece17175 /frontend/views/graph
parent04f7efe6c05153cbd1613e7b0c78b3b6478ae39b (diff)
new page form
Diffstat (limited to 'frontend/views/graph')
-rw-r--r--frontend/views/graph/components/page.form.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/frontend/views/graph/components/page.form.js b/frontend/views/graph/components/page.form.js
index abaf934..ce14e2e 100644
--- a/frontend/views/graph/components/page.form.js
+++ b/frontend/views/graph/components/page.form.js
@@ -5,11 +5,12 @@ import { session } from '../../../session'
import { TextInput, LabelDescription, TextArea, Checkbox, SubmitButton, Loader } from '../../../common'
-const newPage = () => ({
+const newPage = (data) => ({
path: '',
title: '',
username: session('username'),
description: '',
+ ...data,
})
export default class PageForm extends Component {
@@ -21,7 +22,7 @@ export default class PageForm extends Component {
}
componentDidMount() {
- const { data, isNew } = this.props
+ const { graph, data, isNew } = this.props
const title = isNew ? 'new page' : 'editing ' + data.title
const submitTitle = isNew ? "Create Page" : "Save Changes"
this.setState({
@@ -29,8 +30,8 @@ export default class PageForm extends Component {
submitTitle,
errorFields: new Set([]),
data: {
- ...newPage(),
- ...data
+ ...newPage({ graph_id: graph.id }),
+ ...data,
},
})
}