Upload.vue 839 Bytes
Newer Older
1
2
<template>
  <section>
Georg Krause's avatar
Georg Krause committed
3
4
    <file-upload
      ref="fileupload"
5
6
      :default-import-reference="defaultImportReference"
      :library="object"
Georg Krause's avatar
Georg Krause committed
7
8
      @uploads-finished="$emit('uploads-finished', $event)"
    />
9
10
11
12
13
  </section>
</template>

<script>

Ciaran Ainsworth's avatar
Ciaran Ainsworth committed
14
import FileUpload from '@/components/library/FileUpload.vue'
15
16
17

export default {
  components: {
Georg Krause's avatar
Georg Krause committed
18
    FileUpload
19
20
  },

Georg Krause's avatar
Georg Krause committed
21
22
  beforeRouteLeave (to, from, next) {
    if (this.$refs.fileupload.hasActiveUploads) {
23
24
25
26
27
28
      const answer = window.confirm('This page is asking you to confirm that you want to leave - data you have entered may not be saved.')
      if (answer) {
        next()
      } else {
        next(false)
      }
Georg Krause's avatar
Georg Krause committed
29
    } else {
30
31
      next()
    }
Georg Krause's avatar
Georg Krause committed
32
33
34
35
  },
  props: {
    object: { type: String, required: true },
    defaultImportReference: { type: String, required: true }
36
37
38
  }
}
</script>