From 95811492a93253c7694d29714bcecba711cf56aa Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 30 Aug 2022 19:13:02 +0530 Subject: [PATCH] refactor(gui-v2): change client based on language selection Signed-off-by: Pranav C --- packages/nc-gui-v2/components/smartsheet/ApiSnippet.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui-v2/components/smartsheet/ApiSnippet.vue b/packages/nc-gui-v2/components/smartsheet/ApiSnippet.vue index 6ead87ede1..199c768641 100644 --- a/packages/nc-gui-v2/components/smartsheet/ApiSnippet.vue +++ b/packages/nc-gui-v2/components/smartsheet/ApiSnippet.vue @@ -64,7 +64,7 @@ const langs = [ }, ] -const selectedClient = $ref(langs[0].clients && langs[0].clients[0]) +let selectedClient = $ref(langs[0].clients && langs[0].clients[0]) const selectedLangName = $ref(langs[0].name) @@ -123,6 +123,11 @@ const onCopyToClipboard = () => { const afterVisibleChange = (visible: boolean) => { vModel = visible } + +watch($$(activeLang), (newLang) => { + selectedClient = newLang?.clients?.[0] +}) +