diff options
Diffstat (limited to 'packages/frontend/src/pages/registry.value.vue')
| -rw-r--r-- | packages/frontend/src/pages/registry.value.vue | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/packages/frontend/src/pages/registry.value.vue b/packages/frontend/src/pages/registry.value.vue index 68d6c8c1a0..29406ec83c 100644 --- a/packages/frontend/src/pages/registry.value.vue +++ b/packages/frontend/src/pages/registry.value.vue @@ -45,7 +45,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { watch } from 'vue'; +import { watch, computed, ref } from 'vue'; import JSON5 from 'json5'; import * as os from '@/os.js'; import { i18n } from '@/i18n.js'; @@ -61,26 +61,26 @@ const props = defineProps<{ domain: string; }>(); -const scope = $computed(() => props.path.split('/').slice(0, -1)); -const key = $computed(() => props.path.split('/').at(-1)); +const scope = computed(() => props.path.split('/').slice(0, -1)); +const key = computed(() => props.path.split('/').at(-1)); -let value = $ref(null); -let valueForEditor = $ref(null); +const value = ref(null); +const valueForEditor = ref(null); function fetchValue() { os.api('i/registry/get-detail', { - scope, - key, + scope: scope.value, + key: key.value, domain: props.domain === '@' ? null : props.domain, }).then(res => { - value = res; - valueForEditor = JSON5.stringify(res.value, null, '\t'); + value.value = res; + valueForEditor.value = JSON5.stringify(res.value, null, '\t'); }); } async function save() { try { - JSON5.parse(valueForEditor); + JSON5.parse(valueForEditor.value); } catch (err) { os.alert({ type: 'error', @@ -94,9 +94,9 @@ async function save() { }).then(({ canceled }) => { if (canceled) return; os.apiWithDialog('i/registry/set', { - scope, - key, - value: JSON5.parse(valueForEditor), + scope: scope.value, + key: key.value, + value: JSON5.parse(valueForEditor.value), domain: props.domain === '@' ? null : props.domain, }); }); @@ -109,8 +109,8 @@ function del() { }).then(({ canceled }) => { if (canceled) return; os.apiWithDialog('i/registry/remove', { - scope, - key, + scope: scope.value, + key: key.value, domain: props.domain === '@' ? null : props.domain, }); }); @@ -118,9 +118,9 @@ function del() { watch(() => props.path, fetchValue, { immediate: true }); -const headerActions = $computed(() => []); +const headerActions = computed(() => []); -const headerTabs = $computed(() => []); +const headerTabs = computed(() => []); definePageMetadata({ title: i18n.ts.registry, |