diff options
Diffstat (limited to 'src/pages/UploadCreate.vue')
| -rw-r--r-- | src/pages/UploadCreate.vue | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/pages/UploadCreate.vue b/src/pages/UploadCreate.vue index 4b27725..c435a2f 100644 --- a/src/pages/UploadCreate.vue +++ b/src/pages/UploadCreate.vue @@ -43,7 +43,7 @@ </q-alert> <dropzone id="picDropzone" ref="picDropzone" - @vdropzone-success="picUploadSuccess" + @vdropzone-success="uploadSuccess" :options="picDropzoneOptions"> </dropzone> <q-stepper-navigation> @@ -61,7 +61,7 @@ </q-stepper-navigation> </q-step> <q-step name="files" title="Add files"> - <p>Now please upload your mod files (e.g. the .ocs file). You have to upload at least one file</p> + <p>Now please upload your mod files (e.g. the .c4s file). You have to upload at least one file</p> <q-alert color="warning" enter="bounceInLeft" appear> @@ -83,9 +83,9 @@ </tr> </thead> <tbody> - <tr v-for="(file, idx) of files" :key="file._id"> + <tr v-for="(file, idx) of files" :key="file.id"> <td>{{ file.filename }}</td> - <td>{{ file._id }}</td> + <td>{{ file.id }}</td> <td>{{ file.length | prettyBytes }}</td> <td>uploaded {{ file.uploadDate|moment("from") }}</td> <td><q-btn round color="negative" small icon="fa-trash" @click="deleteFile(idx)"></q-btn></td> @@ -110,13 +110,13 @@ </q-step> <q-step name="done" title="Done"> <h6 class="text-positive" v-if="savedScenario"> - Successfully saved your mod with the id {{ savedScenario._id }} + Successfully saved your mod with the id {{ savedScenario.id }} </h6> <q-stepper-navigation> <q-btn color="warning" icon="fa-refresh" @click="reset">Upload another one</q-btn> <q-btn color="primary" icon="fa-eye" - @click="$router.push({name: 'upload-detail', params: {uploadId: savedScenario._id}})"> + @click="$router.push({name: 'upload-detail', params: {uploadId: savedScenario.id}})"> Show the saved mod </q-btn> </q-stepper-navigation> @@ -167,8 +167,8 @@ return { url: `${this.$http.defaults.baseURL}/media`, paramName: 'media', - headers: { Authorization: `Bearer ${this.$store.state.user.authToken}` }, - acceptedFiles: '.ocs,.ocf,.ocd,.ocg,.ocr,.c4d,.c4g,.c4f,.c4r,.c4s,c4v', + headers: { Authorization: `JWT ${this.$store.state.user.authToken}` }, + acceptedFiles: '.ocs,.ocf,.ocd,.ocg,.ocr,.ocu,.c4d,.c4g,.c4f,.c4r,.c4s,.c4v,.c4l,.c4u', dictDefaultMessage: "<p><i class='fa fa-3x fa-cloud-upload'></i></p><p>Drop your mod files here or click to upload</p>", maxFilesize: 30, // MB } @@ -177,7 +177,7 @@ return { url: `${this.$http.defaults.baseURL}/media`, paramName: 'media', - headers: { Authorization: `Bearer ${this.$store.state.user.authToken}` }, + headers: { Authorization: `JWT ${this.$store.state.user.authToken}` }, acceptedFiles: '.png,.jpg', dictDefaultMessage: "<p><i class='fa fa-3x fa-cloud-upload'></i></p><p>Drop your image here or click to upload</p>", maxFilesize: 3, // MB @@ -195,7 +195,7 @@ if (!this.pic) { return '' } - return `${this.$http.defaults.baseURL}/media/${this.pic._id}` + return `${this.$http.defaults.baseURL}/media/${this.pic.id}` }, }, watch: { @@ -209,11 +209,7 @@ deleteFile (idx) { let file = this.files[idx] this.files.splice(idx, 1) - this.$http.delete(`${this.$http.defaults.baseURL}/media/${file._id}`) - }, - picUploadSuccess (file, response) { - this.pic = response - this.$refs.picDropzone.disable() + this.$http.delete(`${this.$http.defaults.baseURL}/media/${file.id}`) }, uploadSuccess (file, response) { this.files.push(response) @@ -238,8 +234,7 @@ let params = { title: this.title, description: this.description, - files: this.files.map(el => el._id), - pic: this.pic, + files: this.files.map(el => el.id), tags: this.tags, } this.$http.post('/uploads', params) |
