Migration to vue3 continued
Remove garbage from vscode renaming Fix reading route in pinia store
This commit is contained in:
parent
7c91ba03b7
commit
85fe716031
@ -203,4 +203,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -129,4 +129,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -134,6 +134,7 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
ProgressBar,
|
ProgressBar,
|
||||||
},
|
},
|
||||||
|
inject: ["$showError"],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useAuthStore, ["user", "isLoggedIn"]),
|
...mapState(useAuthStore, ["user", "isLoggedIn"]),
|
||||||
...mapState(useLayoutStore, ["show"]),
|
...mapState(useLayoutStore, ["show"]),
|
||||||
@ -177,7 +178,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapActions(useLayoutStore, ["closeHovers", "showHover"]),
|
...mapActions(useLayoutStore, ["closeHovers", "showHover"]),
|
||||||
toRoot() {
|
toRoot() {
|
||||||
this.$router.push({ path: "/files/" });
|
this.$router.push({ path: "/files" });
|
||||||
this.closeHovers();
|
this.closeHovers();
|
||||||
},
|
},
|
||||||
toSettings() {
|
toSettings() {
|
||||||
@ -191,4 +192,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/layout
|
|
||||||
|
|||||||
@ -257,4 +257,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -27,4 +27,3 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
@/stores/layout
|
|
||||||
|
|||||||
@ -56,4 +56,3 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
@/stores/layout
|
|
||||||
|
|||||||
@ -123,4 +123,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@ import { useLayoutStore } from "@/stores/layout";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "delete",
|
name: "delete",
|
||||||
|
inject: ["$showError"],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useFileStore, [
|
...mapState(useFileStore, [
|
||||||
"isListing",
|
"isListing",
|
||||||
@ -86,4 +87,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -42,4 +42,3 @@ export default {
|
|||||||
computed: mapState(useLayoutStore, ["showConfirm"]),
|
computed: mapState(useLayoutStore, ["showConfirm"]),
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/layout
|
|
||||||
|
|||||||
@ -140,4 +140,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/file
|
|
||||||
|
|||||||
@ -43,4 +43,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/layout
|
|
||||||
|
|||||||
@ -157,4 +157,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -105,4 +105,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -51,6 +51,7 @@ export default {
|
|||||||
name: "",
|
name: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
inject: ["$showError"],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useFileStore, ["isFiles", "isListing"]),
|
...mapState(useFileStore, ["isFiles", "isListing"]),
|
||||||
},
|
},
|
||||||
@ -72,7 +73,7 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await api.post(uri);
|
await api.post(uri);
|
||||||
this.$router.push({ path: uri });
|
this.$router.push({ path: `${uri}` });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$showError(e);
|
this.$showError(e);
|
||||||
}
|
}
|
||||||
@ -82,4 +83,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -51,6 +51,7 @@ export default {
|
|||||||
name: "",
|
name: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
inject: ["$showError"],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useFileStore, ["isFiles", "isListing"]),
|
...mapState(useFileStore, ["isFiles", "isListing"]),
|
||||||
},
|
},
|
||||||
@ -82,4 +83,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -115,4 +115,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/layout
|
|
||||||
|
|||||||
@ -113,4 +113,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -51,4 +51,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/layout
|
|
||||||
|
|||||||
@ -51,4 +51,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/layout
|
|
||||||
|
|||||||
@ -257,4 +257,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -41,4 +41,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/layout
|
|
||||||
|
|||||||
@ -62,4 +62,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/upload
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
import "whatwg-fetch";
|
import "whatwg-fetch";
|
||||||
import cssVars from "css-vars-ponyfill";
|
import cssVars from "css-vars-ponyfill";
|
||||||
|
import Noty from "noty";
|
||||||
|
import { disableExternal } from "@/utils/constants";
|
||||||
import { createApp } from "vue";
|
import { createApp } from "vue";
|
||||||
import VueLazyload from "vue-lazyload";
|
import VueLazyload from "vue-lazyload";
|
||||||
import createPinia from "@/stores";
|
import createPinia from "@/stores";
|
||||||
@ -33,4 +35,53 @@ app.directive("focus", {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const notyDefault = {
|
||||||
|
type: "info",
|
||||||
|
layout: "bottomRight",
|
||||||
|
timeout: 1000,
|
||||||
|
progressBar: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
app.provide("$noty", (opts) => {
|
||||||
|
new Noty(Object.assign({}, notyDefault, opts)).show();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.provide("$showSuccess", (message) => {
|
||||||
|
new Noty(
|
||||||
|
Object.assign({}, notyDefault, {
|
||||||
|
text: message,
|
||||||
|
type: "success",
|
||||||
|
})
|
||||||
|
).show();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.provide("$showError", (error, displayReport = true) => {
|
||||||
|
let btns = [
|
||||||
|
Noty.button(i18n.global.t("buttons.close"), "", function () {
|
||||||
|
n.close();
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!disableExternal && displayReport) {
|
||||||
|
btns.unshift(
|
||||||
|
Noty.button(i18n.global.t("buttons.reportIssue"), "", function () {
|
||||||
|
window.open(
|
||||||
|
"https://github.com/filebrowser/filebrowser/issues/new/choose"
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let n = new Noty(
|
||||||
|
Object.assign({}, notyDefault, {
|
||||||
|
text: error.message || error,
|
||||||
|
type: "error",
|
||||||
|
timeout: null,
|
||||||
|
buttons: btns,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
n.show();
|
||||||
|
});
|
||||||
|
|
||||||
router.isReady().then(() => app.mount("#app"));
|
router.isReady().then(() => app.mount("#app"));
|
||||||
|
|||||||
@ -142,15 +142,9 @@ const routes = [
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// path: "/files",
|
|
||||||
// redirect: {
|
|
||||||
// path: "/files/",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
path: "/:catchAll(.*)*",
|
path: "/:catchAll(.*)*",
|
||||||
redirect: (to) => `/files${to.params.catchAll}`,
|
redirect: (to) => `/files/${[...to.params.catchAll].join("/")}`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { useRouterStore } from "./router";
|
import { useRouterStore } from "./router";
|
||||||
// import { useAuthPreferencesStore } from "./auth-preferences";
|
import { useLayoutStore } from "./layout";
|
||||||
// import { useAuthEmailStore } from "./auth-email";
|
|
||||||
|
|
||||||
export const useFileStore = defineStore("file", {
|
export const useFileStore = defineStore("file", {
|
||||||
// convert to a function
|
// convert to a function
|
||||||
@ -13,17 +12,17 @@ export const useFileStore = defineStore("file", {
|
|||||||
multiple: false,
|
multiple: false,
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
// user and jwt getter removed, no longer needed
|
|
||||||
selectedCount: (state) => state.selected.length,
|
selectedCount: (state) => state.selected.length,
|
||||||
route: () => {
|
route: () => {
|
||||||
const routerStore = useRouterStore();
|
const routerStore = useRouterStore();
|
||||||
return routerStore.router.currentRoute;
|
return routerStore.router.currentRoute;
|
||||||
},
|
},
|
||||||
isFiles(state) {
|
isFiles: (state) => {
|
||||||
return !state.loading && this.route.name === "Files";
|
const layoutStore = useLayoutStore();
|
||||||
|
return !layoutStore.loading && state.route._value.name === "Files";
|
||||||
},
|
},
|
||||||
isListing(state) {
|
isListing: (state) => {
|
||||||
return this.isFiles && state.req.isDir;
|
return state.isFiles && state.req.isDir;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
@ -123,7 +123,7 @@ export default {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
clean(res.path) !==
|
clean(res.path) !==
|
||||||
clean(`/${this.$route.params.path}`).replace(/,/g, "/")
|
clean(`/${[...this.$route.params.path].join("/")}`)
|
||||||
) {
|
) {
|
||||||
throw new Error("Data Mismatch!");
|
throw new Error("Data Mismatch!");
|
||||||
}
|
}
|
||||||
@ -146,4 +146,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -52,4 +52,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/layout@/stores/file
|
|
||||||
|
|||||||
@ -66,4 +66,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/file
|
|
||||||
|
|||||||
@ -360,4 +360,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -146,4 +146,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/file
|
|
||||||
|
|||||||
@ -905,4 +905,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/clipboard@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -360,4 +360,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -368,4 +368,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/file
|
|
||||||
|
|||||||
@ -168,4 +168,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/file
|
|
||||||
|
|||||||
@ -143,4 +143,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/file
|
|
||||||
|
|||||||
@ -173,4 +173,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/auth@/stores/file@/stores/layout
|
|
||||||
|
|||||||
@ -74,4 +74,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@/stores/file
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user