fix(api): add discord webhook manual instructions

This commit is contained in:
Ruben Fiszel
2022-08-04 17:49:13 +02:00
parent ced2b960f2
commit c5ccb00dbf
2 changed files with 13 additions and 3 deletions
+13 -3
View File
@@ -1,8 +1,13 @@
<script lang="ts" context="module">
const apiTokenApps: Record<string, { img?: string; instructions: string }> = {
const apiTokenApps: Record<string, { img?: string; instructions: string; key?: string }> = {
airtable: {
img: 'airtable_connect.png',
instructions: 'Click on the top-right avatar -> Account -> Api'
},
discord_webhook: {
img: 'discord_webhook.png',
instructions: 'Server Settings -> Integration -> Webhooks',
key: 'webhook_url'
}
}
</script>
@@ -28,6 +33,9 @@
let valueToken: TokenResponse
let connects: Record<string, { scopes: string[]; extra_params?: Record<string, string> }> = {}
let connectsManual: [string, { img?: string; instructions: string }][] = []
let key: string = 'token'
$: key = apiTokenApps[resource_type]?.key ?? 'token'
let scopes: string[] = []
let extra_params: [string, string][] = []
@@ -101,7 +109,7 @@
}
let account: number | undefined = undefined
if (valueToken.refresh_token != undefined && valueToken.expires_in != undefined) {
if (valueToken?.refresh_token != undefined && valueToken?.expires_in != undefined) {
account = Number(
await OauthService.createAccount({
workspace: $workspaceStore!,
@@ -125,12 +133,14 @@
account: account
}
})
const resourceValue = {}
resourceValue[key] = `$var:${path}`
await ResourceService.createResource({
workspace: $workspaceStore!,
requestBody: {
resource_type,
path,
value: { token: `$var:${path}` },
value: resourceValue,
description: `OAuth token for ${resource_type}`,
is_oauth: true
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB