diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-18 20:33:30 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-18 20:33:30 +0100 |
| commit | ccaa55434ff44e0149c5984f2e5968139bbe3baa (patch) | |
| tree | be5525bcacaf60cf0de7230942ef2de509baee24 /frontend | |
| parent | baf406f060ee7f840771d45932dfd8279d551561 (diff) | |
populate script. delete pages.
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/app/actions.js | 4 | ||||
| -rw-r--r-- | frontend/app/views/graph/components/page.edit.js | 1 | ||||
| -rw-r--r-- | frontend/app/views/graph/components/page.form.js | 12 |
3 files changed, 13 insertions, 4 deletions
diff --git a/frontend/app/actions.js b/frontend/app/actions.js index 0fba6d1..6cfa470 100644 --- a/frontend/app/actions.js +++ b/frontend/app/actions.js @@ -1,5 +1,5 @@ import { bindActionCreators } from 'redux' -import { actions as crudActions } from './api' +import { actions as crudActions } from 'app/api' import * as siteActions from 'app/views/site/site.actions' @@ -15,4 +15,4 @@ export default .concat([ // ['socket', socketActions], ]) - .reduce((a,b) => (a[b[0]] = b[1])&&a,{})
\ No newline at end of file + .reduce((a,b) => (a[b[0]] = b[1])&&a,{}) diff --git a/frontend/app/views/graph/components/page.edit.js b/frontend/app/views/graph/components/page.edit.js index 4025726..16a7eef 100644 --- a/frontend/app/views/graph/components/page.edit.js +++ b/frontend/app/views/graph/components/page.edit.js @@ -45,6 +45,7 @@ class PageEdit extends Component { return ( <PageForm data={show.res} + actions={{ graph: this.props.graphActions }} graph={this.props.graph.show.res} onSubmit={this.handleSubmit.bind(this)} /> diff --git a/frontend/app/views/graph/components/page.form.js b/frontend/app/views/graph/components/page.form.js index 8148864..a060698 100644 --- a/frontend/app/views/graph/components/page.form.js +++ b/frontend/app/views/graph/components/page.form.js @@ -2,6 +2,8 @@ import React, { Component } from 'react' import { Link } from 'react-router-dom' import { session } from 'app/session' +import actions from 'app/actions' +import { history } from 'app/store' import { TextInput, ColorInput, Checkbox, LabelDescription, TextArea, SubmitButton, Loader } from 'app/common' import AudioSelect from 'app/views/audio/components/audio.select' @@ -127,11 +129,17 @@ export default class PageForm extends Component { } } - handleDelete() { + handleDelete(e) { + e && e.preventDefault() + e && e.stopPropagation() const { data } = this.state console.log(data) if (confirm('Really delete this page?')) { - actions.page.delete(page_id) + actions.page.destroy(data) + .then(() => { + this.props.actions.graph.hideEditPageForm() + history.goBack() + }) } } |
