From ff48178051c4726093751bc3a2317e836ea8b99c Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 21 Jul 2022 16:11:45 +0200 Subject: [PATCH] fix: general user settings empty when loading the settings page Resolves https://kolaente.dev/vikunja/frontend/issues/2183 --- src/helpers/objectIsEmpty.ts | 6 ++++++ src/views/user/settings/General.vue | 30 +++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 src/helpers/objectIsEmpty.ts diff --git a/src/helpers/objectIsEmpty.ts b/src/helpers/objectIsEmpty.ts new file mode 100644 index 00000000..e51e2c4f --- /dev/null +++ b/src/helpers/objectIsEmpty.ts @@ -0,0 +1,6 @@ +// https://stackoverflow.com/a/32108184/10924593 +export function objectIsEmpty(obj: any): boolean { + return obj + && Object.keys(obj).length === 0 + && Object.getPrototypeOf(obj) === Object.prototype +} \ No newline at end of file diff --git a/src/views/user/settings/General.vue b/src/views/user/settings/General.vue index 0efc6b22..dec9c826 100644 --- a/src/views/user/settings/General.vue +++ b/src/views/user/settings/General.vue @@ -85,7 +85,8 @@ v-for="lang in availableLanguageOptions" :key="lang.code" :value="lang.code" - >{{ lang.title }} + >{{ lang.title }} + @@ -154,7 +155,7 @@ export default defineComponent({