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, listing: true,
}; };
}, },
inject: ["$showError"], inject: ["$showError", "$showSuccess"],
computed: { computed: {
...mapState(useFileStore, [ ...mapState(useFileStore, [
"req", "req",

View File

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

View File

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

View File

@ -113,7 +113,7 @@
</a> </a>
</div> </div>
<div class="share__box__element share__box__center"> <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> </div>
<div <div
@ -221,7 +221,7 @@ export default {
}, },
}, },
created: async function () { created: async function () {
const hash = this.$route.params.pathMatch.split("/")[0]; const hash = this.$route.params.path[0];
this.hash = hash; this.hash = hash;
await this.fetchData(); await this.fetchData();
}, },

View File

@ -44,7 +44,12 @@
<h3>{{ $t("settings.branding") }}</h3> <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 <a
class="link" class="link"
target="_blank" target="_blank"
@ -177,7 +182,12 @@
</div> </div>
<div class="card-content"> <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>FILE</code>
<code>SCOPE</code> <code>SCOPE</code>
<a <a

View File

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

View File

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