diff options
| author | Shpuld Shpludson <shp@cock.li> | 2019-04-30 15:11:30 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2019-04-30 15:11:30 +0000 |
| commit | b1bd5bd08eccbe93d37aa1708692cad50003fd58 (patch) | |
| tree | de2de7d792a17ccd1ac74773cd05f3d18c2de60e /src/components/importer/importer.js | |
| parent | da08388d6af314fb298bae011da31bcfc8ac0a45 (diff) | |
| parent | 0f7f685c5e720d870cc732f07f68fb6eac278a68 (diff) | |
Merge branch 'develop' into 'brendenbice1222/pleroma-fe-issues/pleroma-fe-202-show-boosted-users'
# Conflicts:
# src/services/api/api.service.js
Diffstat (limited to 'src/components/importer/importer.js')
| -rw-r--r-- | src/components/importer/importer.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/components/importer/importer.js b/src/components/importer/importer.js new file mode 100644 index 00000000..c5f9e4d2 --- /dev/null +++ b/src/components/importer/importer.js @@ -0,0 +1,53 @@ +const Importer = { + props: { + submitHandler: { + type: Function, + required: true + }, + submitButtonLabel: { + type: String, + default () { + return this.$t('importer.submit') + } + }, + successMessage: { + type: String, + default () { + return this.$t('importer.success') + } + }, + errorMessage: { + type: String, + default () { + return this.$t('importer.error') + } + } + }, + data () { + return { + file: null, + error: false, + success: false, + submitting: false + } + }, + methods: { + change () { + this.file = this.$refs.input.files[0] + }, + submit () { + this.dismiss() + this.submitting = true + this.submitHandler(this.file) + .then(() => { this.success = true }) + .catch(() => { this.error = true }) + .finally(() => { this.submitting = false }) + }, + dismiss () { + this.success = false + this.error = false + } + } +} + +export default Importer |
