Browse Source

Nc docs/auth api token (#8586)

* fix: message in api snippet

* fix: apis => apiSnippet

* fix: replace localhost with actual route

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* fix: review comments

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

---------

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/8618/head
Raju Udava 6 months ago committed by GitHub
parent
commit
cff757c3b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      packages/nc-gui/components/smartsheet/Details.vue
  2. 10
      packages/nc-gui/components/smartsheet/details/Api.vue
  3. 1
      packages/nc-gui/lang/en.json

2
packages/nc-gui/components/smartsheet/Details.vue

@ -76,7 +76,7 @@ watch(openedSubTab, () => {
<template #tab> <template #tab>
<div class="tab" data-testid="nc-apis-tab"> <div class="tab" data-testid="nc-apis-tab">
<GeneralIcon icon="code" class="tab-icon" :class="{}" /> <GeneralIcon icon="code" class="tab-icon" :class="{}" />
<div>{{ $t('labels.apis') }}</div> <div>{{ $t('labels.apiSnippet') }}</div>
</div> </div>
</template> </template>
<SmartsheetDetailsApi v-if="base && meta && view" /> <SmartsheetDetailsApi v-if="base && meta && view" />

10
packages/nc-gui/components/smartsheet/details/Api.vue

@ -73,7 +73,13 @@ const snippet = computed(
() => () =>
new HTTPSnippet({ new HTTPSnippet({
method: 'GET', method: 'GET',
headers: [{ name: 'xc-token', value: '<Your API Token>', comment: 'API token' }], headers: [
{
name: 'xc-token',
value: `CREATE_YOUR_API_TOKEN_FROM ${location.origin + location.pathname}#/account/tokens`,
comment: 'API token',
},
],
url: apiUrl.value, url: apiUrl.value,
queryString: [ queryString: [
...Object.entries(queryParams.value || {}).map(([name, value]) => { ...Object.entries(queryParams.value || {}).map(([name, value]) => {
@ -95,7 +101,7 @@ const code = computed(() => {
const api = new Api({ const api = new Api({
baseURL: "${(appInfo.value && appInfo.value.ncSiteUrl) || '/'}", baseURL: "${(appInfo.value && appInfo.value.ncSiteUrl) || '/'}",
headers: { headers: {
"xc-token": "<Your API Token>" "xc-token": "CREATE_YOUR_API_TOKEN_FROM ${location.origin + location.pathname}#/account/tokens"
} }
}) })

1
packages/nc-gui/lang/en.json

@ -738,6 +738,7 @@
"noAccess": "No access", "noAccess": "No access",
"restApis": "Rest APIs", "restApis": "Rest APIs",
"apis": "APIs", "apis": "APIs",
"apiSnippet": "API Snippets",
"includeData": "Include Data", "includeData": "Include Data",
"includeView": "Include View", "includeView": "Include View",
"includeWebhook": "Include Webhook", "includeWebhook": "Include Webhook",

Loading…
Cancel
Save