Files
mealie/frontend/src/components/Settings/Migration/UploadMigrationButton.vue

49 lines
883 B
Vue
Raw Normal View History

2021-01-09 18:55:26 -09:00
<template>
<v-form ref="file">
<v-file-input
:loading="loading"
label="Upload an Archive"
v-model="file"
accept=".zip"
@change="upload"
2021-01-09 19:45:08 -09:00
:prepend-icon="icon"
class="file-icon"
2021-01-09 18:55:26 -09:00
>
</v-file-input>
</v-form>
</template>
<script>
import api from "../../../api";
export default {
data() {
return {
file: null,
loading: false,
2021-01-09 19:45:08 -09:00
icon: "mdi-paperclip",
2021-01-09 18:55:26 -09:00
};
},
methods: {
async upload() {
if (this.file != null) {
this.loading = true;
let formData = new FormData();
formData.append("archive", this.file);
await api.migrations.uploadFile(formData);
this.loading = false;
this.$emit("uploaded");
this.file = null;
2021-01-09 19:45:08 -09:00
this.icon = "mdi-check";
2021-01-09 18:55:26 -09:00
}
},
},
};
</script>
<style>
2021-01-09 19:45:08 -09:00
.file-icon {
transition-duration: 5s;
}
2021-01-09 18:55:26 -09:00
</style>