Add files via upload

This commit is contained in:
niubility000 2021-10-20 23:06:50 +08:00 committed by GitHub
parent deabc80fd7
commit 2061cb4851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -83,19 +83,12 @@ export default {
}); });
}; };
if (this.$route.path === this.dest) {
this.$store.commit("closeHovers");
action(false, true);
return;
}
let dstItems = (await api.fetch(this.dest)).items; let dstItems = (await api.fetch(this.dest)).items;
let conflict = upload.checkConflict(items, dstItems); let conflict = upload.checkConflict(items, dstItems);
let overwrite = false; let overwrite = false;
let rename = false; let rename = false;
window.sessionStorage.setItem('destDir', this.dest);
if (conflict) { if (conflict) {
this.$store.commit("showHover", { this.$store.commit("showHover", {
prompt: "replace-rename", prompt: "replace-rename",
@ -113,6 +106,10 @@ export default {
} }
action(overwrite, rename); action(overwrite, rename);
if (!conflict) {
this.$store.commit("closeHovers");
return;
}
}, },
}, },
}; };

View File

@ -28,6 +28,7 @@
<button <button
class="button button--flat button--red" class="button button--flat button--red"
@click="(event) => showConfirm(event, 'overwrite')" @click="(event) => showConfirm(event, 'overwrite')"
:disabled="$route.path === dest"
:aria-label="$t('buttons.replace')" :aria-label="$t('buttons.replace')"
:title="$t('buttons.replace')" :title="$t('buttons.replace')"
> >
@ -42,6 +43,11 @@ import { mapState } from "vuex";
export default { export default {
name: "replace-rename", name: "replace-rename",
data() {
return {
dest: window.sessionStorage.getItem('destDir'),
};
},
computed: mapState(["showConfirm"]), computed: mapState(["showConfirm"]),
}; };
</script> </script>