Fix errors in settings and shares

This commit is contained in:
Kloon ImKloon 2023-09-04 12:15:39 +02:00
parent 75bc9c4459
commit ce67fb5964
No known key found for this signature in database
GPG Key ID: CCF1C86A995C5B6A
7 changed files with 32 additions and 10 deletions

View File

@ -145,7 +145,7 @@ export default {
listing: true,
};
},
inject: ["$showError"],
inject: ["$showError", "$showSuccess"],
computed: {
...mapState(useFileStore, [
"req",

View File

@ -1,5 +1,5 @@
import { disableExternal } from "@/utils/constants";
import { createApp } from "vue";
import { createApp, configureCompat } from "vue";
import Noty from "noty";
import VueLazyload from "vue-lazyload";
import createPinia from "@/stores";
@ -7,7 +7,7 @@ import router from "@/router";
import i18n from "@/i18n";
import App from "@/App.vue";
// import "core-js/actual/structured-clone";
configureCompat({ RENDER_FUNCTION: false });
import dayjs from "dayjs";
import localizedFormat from "dayjs/plugin/localizedFormat";

View File

@ -1,6 +1,7 @@
import { defineStore } from "pinia";
import dayjs from "dayjs";
import i18n, { detectLocale } from "@/i18n";
import { cloneDeep } from "lodash-es";
export const useAuthStore = defineStore("auth", {
// convert to a function
@ -35,7 +36,7 @@ export const useAuthStore = defineStore("auth", {
i18n.global.locale.value = locale;
}
this.user[field] = structuredClone(value[field]);
this.user[field] = cloneDeep(value[field]);
}
},
// easily reset state using `$reset`

View File

@ -113,7 +113,7 @@
</a>
</div>
<div class="share__box__element share__box__center">
<qrcode-vue :value="link" size="200" level="M"></qrcode-vue>
<qrcode-vue :value="link" :size="200" level="M"></qrcode-vue>
</div>
</div>
<div
@ -221,7 +221,7 @@ export default {
},
},
created: async function () {
const hash = this.$route.params.pathMatch.split("/")[0];
const hash = this.$route.params.path[0];
this.hash = hash;
await this.fetchData();
},

View File

@ -44,7 +44,12 @@
<h3>{{ $t("settings.branding") }}</h3>
<i18n-t keypath="settings.brandingHelp" tag="p" class="small">
<i18n-t
keypath="settings.brandingHelp"
tag="p"
class="small"
scope="global"
>
<a
class="link"
target="_blank"
@ -177,7 +182,12 @@
</div>
<div class="card-content">
<i18n-t keypath="settings.commandRunnerHelp" tag="p" class="small">
<i18n-t
keypath="settings.commandRunnerHelp"
tag="p"
class="small"
scope="global"
>
<code>FILE</code>
<code>SCOPE</code>
<a

View File

@ -118,6 +118,7 @@ export default {
this.hideDotfiles = this.user.hideDotfiles;
this.singleClick = this.user.singleClick;
this.dateFormat = this.user.dateFormat;
this.loading = false;
},
methods: {
...mapActions(useAuthStore, ["updateUser"]),

View File

@ -28,6 +28,15 @@
>
{{ $t("buttons.delete") }}
</button>
<router-link to="/settings/users">
<button
class="button button--flat button--grey"
:aria-label="$t('buttons.cancel')"
:title="$t('buttons.cancel')"
>
{{ $t("buttons.cancel") }}
</button>
</router-link>
<input
class="button button--flat"
type="submit"
@ -67,6 +76,7 @@ import { useLayoutStore } from "@/stores/layout";
import { users as api, settings } from "@/api";
import UserForm from "@/components/settings/UserForm.vue";
import Errors from "@/views/Errors.vue";
import { cloneDeep } from "lodash-es";
export default {
name: "user",
@ -120,7 +130,7 @@ export default {
id: 0,
};
} else {
const id = this.$route.params.pathMatch;
const id = this.$route.params.id;
this.user = { ...(await api.get(id)) };
}
} catch (e) {
@ -161,7 +171,7 @@ export default {
await api.update(user);
if (user.id === this.user.id) {
this.setUser({ ...structuredClone(user) });
this.setUser({ ...cloneDeep(user) });
}
this.$showSuccess(this.$t("settings.userUpdated"));