From 8d27c68d5f02e0b8dca4d67735a226d633d94c40 Mon Sep 17 00:00:00 2001 From: tusooa Date: Fri, 10 Mar 2023 19:24:01 -0500 Subject: [PATCH] Support editing --- src/components/draft/draft.js | 2 + src/components/draft/draft.vue | 6 +++ .../edit_status_form/edit_status_form.js | 41 +++++++++++++++++++ .../edit_status_form/edit_status_form.vue | 10 +++++ .../edit_status_modal/edit_status_modal.js | 28 +------------ .../edit_status_modal/edit_status_modal.vue | 7 +--- 6 files changed, 63 insertions(+), 31 deletions(-) create mode 100644 src/components/edit_status_form/edit_status_form.js create mode 100644 src/components/edit_status_form/edit_status_form.vue diff --git a/src/components/draft/draft.js b/src/components/draft/draft.js index 9b052606..f5f44467 100644 --- a/src/components/draft/draft.js +++ b/src/components/draft/draft.js @@ -1,10 +1,12 @@ import PostStatusForm from 'src/components/post_status_form/post_status_form.vue' +import EditStatusForm from 'src/components/edit_status_form/edit_status_form.vue' import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue' import StatusContent from 'src/components/status_content/status_content.vue' const Draft = { components: { PostStatusForm, + EditStatusForm, ConfirmModal, StatusContent }, diff --git a/src/components/draft/draft.vue b/src/components/draft/draft.vue index 6e1b65bd..43b14721 100644 --- a/src/components/draft/draft.vue +++ b/src/components/draft/draft.vue @@ -46,9 +46,15 @@
+
{ + return data + }) + .catch((err) => { + console.error('Error editing status', err) + return { + error: err.message + } + }) + } + } +} + +export default EditStatusForm diff --git a/src/components/edit_status_form/edit_status_form.vue b/src/components/edit_status_form/edit_status_form.vue new file mode 100644 index 00000000..eee2d39a --- /dev/null +++ b/src/components/edit_status_form/edit_status_form.vue @@ -0,0 +1,10 @@ + + + diff --git a/src/components/edit_status_modal/edit_status_modal.js b/src/components/edit_status_modal/edit_status_modal.js index 75adfea7..90964c95 100644 --- a/src/components/edit_status_modal/edit_status_modal.js +++ b/src/components/edit_status_modal/edit_status_modal.js @@ -1,11 +1,10 @@ -import PostStatusForm from '../post_status_form/post_status_form.vue' +import EditStatusForm from '../edit_status_form/edit_status_form.vue' import Modal from '../modal/modal.vue' -import statusPosterService from '../../services/status_poster/status_poster.service.js' import get from 'lodash/get' const EditStatusModal = { components: { - PostStatusForm, + EditStatusForm, Modal }, data () { @@ -43,29 +42,6 @@ const EditStatusModal = { } }, methods: { - doEditStatus ({ status, spoilerText, sensitive, media, contentType, poll }) { - const params = { - store: this.$store, - statusId: this.$store.state.editStatus.params.statusId, - status, - spoilerText, - sensitive, - poll, - media, - contentType - } - - return statusPosterService.editStatus(params) - .then((data) => { - return data - }) - .catch((err) => { - console.error('Error editing status', err) - return { - error: err.message - } - }) - }, closeModal () { this.$store.dispatch('closeEditStatusModal') } diff --git a/src/components/edit_status_modal/edit_status_modal.vue b/src/components/edit_status_modal/edit_status_modal.vue index db62972d..96d05343 100644 --- a/src/components/edit_status_modal/edit_status_modal.vue +++ b/src/components/edit_status_modal/edit_status_modal.vue @@ -8,12 +8,9 @@
{{ $t('post_status.edit_status') }}
-