Browse Source

Implement download feature roughly

pull/341/head
Hironsan 5 years ago
parent
commit
25c6877123
2 changed files with 24 additions and 2 deletions
  1. 5
      frontend/api/routes/docs.js
  2. 21
      frontend/pages/projects/_id/download/index.vue

5
frontend/api/routes/docs.js

@ -34,6 +34,11 @@ router.post('/upload', (req, res) => {
res.json(doc)
})
// Download a file.
router.get('/download', (req, res) => {
res.json(db)
})
// Update a document partially.
router.patch('/:docId', (req, res) => {
const docIndex = db.findIndex(item => item.id === parseInt(req.params.docId))

21
frontend/pages/projects/_id/download/index.vue

@ -1,9 +1,26 @@
<template>
<div />
<v-card>
<v-card-title>
Export
</v-card-title>
<v-card-text>
<a :href="url" download="docs.json">Download</a>
</v-card-text>
</v-card>
</template>
<script>
export default {
layout: 'project'
layout: 'project',
computed: {
url() {
const projectId = this.$route.params.id
return `/v1/projects/${projectId}/docs/download`
}
},
validate({ params }) {
return /^\d+$/.test(params.id)
}
}
</script>
Loading…
Cancel
Save